forked from loafle/openapi-generator-original
Merge pull request #2614 from wing328/bug/fix_requiredParamCount
Bug fix for requiredParamCount
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
#!/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
|
||||
|
||||
cd $APP_DIR
|
||||
./bin/android-java-wordnik-api.sh
|
||||
./bin/java-wordnik-api.sh
|
||||
./bin/objc-wordnik-api.sh
|
||||
./bin/scala-wordnik-api.sh
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l android -o samples/client/wordnik/android-java"
|
||||
|
||||
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 dart -o samples/client/petstore/dart"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l java -o samples/client/wordnik/java"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l objc -o samples/client/wordnik/objc"
|
||||
|
||||
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 -t modules/swagger-codegen/src/main/resources/asyncscala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l async-scala -o samples/client/petstore/async-scala"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/asyncscala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l async-scala -o samples/client/petstore/async-scala"
|
||||
|
||||
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 -t modules/swagger-codegen/src/main/resources/scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scala -o samples/client/petstore/scala"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l scala -o samples/client/petstore/scala"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l scala -o samples/client/wordnik/scala"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -34,7 +34,7 @@ class {{classname}} {
|
||||
|
||||
{{#allParams}}
|
||||
// verify required params are set
|
||||
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
|
||||
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||
throw new RuntimeException("missing required params")
|
||||
}
|
||||
{{/allParams}}
|
||||
@@ -53,4 +53,4 @@ class {{classname}} {
|
||||
}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
{{/operations}}
|
||||
|
||||
@@ -10,7 +10,7 @@ import collection.mutable
|
||||
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
{{#operation}}
|
||||
def {{nickname}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
||||
def {{operationId}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
||||
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
||||
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||
// create path and map variables
|
||||
@@ -21,14 +21,28 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
{{#allParams}}// verify required params are set
|
||||
val paramCount = (Set[Any]({{/allParams}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#allParams}}) - null).size
|
||||
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/allParams}}
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
{{^isPrimitiveType}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
|
||||
{{#queryParams}}{{^required}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/required}}{{#required}}
|
||||
if({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString{{/required}}{{/queryParams}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#queryParams}}
|
||||
{{^required}}
|
||||
if ({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }
|
||||
|
||||
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}.toString{{/headerParams}}
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
if ({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
|
||||
{{/required}}
|
||||
{{/queryParams}}
|
||||
|
||||
{{#headerParams}}
|
||||
headerParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/headerParams}}
|
||||
|
||||
val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{paramName}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}})
|
||||
resFuture flatMap { resp =>
|
||||
|
||||
@@ -20,7 +20,7 @@ class {{classname}} {
|
||||
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||
{{#allParams}}
|
||||
// verify required params are set
|
||||
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
|
||||
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}{{/allParams}}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class {{classname}} extends SwaggerApi {
|
||||
|
||||
{{#allParams}}
|
||||
// verify required params are set
|
||||
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
|
||||
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
{{/allParams}}
|
||||
|
||||
52
modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache
Executable file
52
modules/swagger-codegen/src/main/resources/flash/git_push.sh.mustache
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="{{{gitUserId}}}"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="{{{gitRepoId}}}"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="{{{releaseNote}}}"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Build and Release Folders
|
||||
bin/
|
||||
bin-debug/
|
||||
bin-release/
|
||||
|
||||
# Other files and folders
|
||||
.settings/
|
||||
|
||||
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
|
||||
# should NOT be excluded as they contain compiler settings and other important
|
||||
# information for Eclipse / Flash Builder.
|
||||
@@ -45,13 +45,13 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
{{#allParams}}
|
||||
// verify required params are set
|
||||
(List({{/allParams}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#allParams}}).filter(_ != null)).size match {
|
||||
case {{requiredParamCount}} => // all required values set
|
||||
case _ => throw new Exception("missing required params")
|
||||
}
|
||||
{{/allParams}}
|
||||
{{#required}}
|
||||
{{^isPrimitiveType}}
|
||||
if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||
|
||||
{{/isPrimitiveType}}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
{{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||
{{/queryParams}}
|
||||
|
||||
@@ -71,7 +71,8 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
{{#formParams}}{{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
|
||||
{{#formParams}}
|
||||
{{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
|
||||
{{/formParams}}
|
||||
}
|
||||
|
||||
@@ -87,6 +88,7 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
||||
@@ -3,7 +3,7 @@ organization := ""
|
||||
name := "-client"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"io.swagger" %% "swagger-async-httpclient" % "0.3.5",
|
||||
"com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.5",
|
||||
"joda-time" % "joda-time" % "2.3",
|
||||
"org.joda" % "joda-convert" % "1.3.1",
|
||||
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.swagger.client
|
||||
|
||||
import io.swagger.client.api._
|
||||
|
||||
import io.swagger.client._
|
||||
import com.wordnik.swagger.client._
|
||||
|
||||
import java.io.Closeable
|
||||
|
||||
@@ -14,14 +14,14 @@ class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
||||
|
||||
protected def transportClient: TransportClient = new RestClient(config)
|
||||
|
||||
val user = new UserApi(client, config)
|
||||
|
||||
val pet = new PetApi(client, config)
|
||||
|
||||
val store = new StoreApi(client, config)
|
||||
|
||||
val user = new UserApi(client, config)
|
||||
|
||||
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Pet
|
||||
import io.swagger.client.model.ApiResponse
|
||||
import java.io.File
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def updatePet(body: Option[Pet] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
def addPet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
@@ -19,33 +17,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->addPet")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def addPet(body: Option[Pet] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
@@ -53,98 +27,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def findPetsByStatus(status: Option[List[String]] = Some(available)
|
||||
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/findByStatus"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
if(status != null) status.foreach { v => queryParams += "status" -> v.toString }
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def findPetsByTags(tags: Option[List[String]] = None
|
||||
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/findByTags"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
if(tags != null) tags.foreach { v => queryParams += "tags" -> v.toString }
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def updatePetWithForm(petId: String,
|
||||
name: Option[String] = None,
|
||||
status: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deletePet(petId: Long,
|
||||
apiKey: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
@@ -156,9 +38,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey.toString
|
||||
|
||||
@@ -168,11 +47,105 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def findPetsByStatus(status: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/findByStatus"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (status == null) throw new Exception("Missing required parameter 'status' when calling PetApi->findPetsByStatus")
|
||||
|
||||
if (status != null) queryParams += "status" -> status.toString
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def findPetsByTags(tags: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/findByTags"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (tags == null) throw new Exception("Missing required parameter 'tags' when calling PetApi->findPetsByTags")
|
||||
|
||||
if (tags != null) queryParams += "tags" -> tags.toString
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def updatePet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->updatePet")
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def updatePetWithForm(petId: Long,
|
||||
name: Option[String] = None,
|
||||
status: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def uploadFile(petId: Long,
|
||||
additionalMetadata: Option[String] = None,
|
||||
file: Option[File] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
)(implicit reader: ClientResponseReader[ApiResponse]): Future[ApiResponse] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}/uploadImage")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
@@ -181,11 +154,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
@@ -193,6 +162,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,79 +1,12 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Order
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/inventory"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def placeOrder(body: Option[Order] = None
|
||||
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
@@ -83,11 +16,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
@@ -95,6 +24,56 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/inventory"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def getOrderById(orderId: Long)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def placeOrder(body: Order)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling StoreApi->placeOrder")
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.User
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def createUser(body: Option[User] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
def createUser(body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user"))
|
||||
|
||||
@@ -18,11 +15,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUser")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
@@ -30,9 +25,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def createUsersWithArrayInput(body: Option[List[User]] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
def createUsersWithArrayInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/createWithArray"))
|
||||
|
||||
@@ -40,11 +33,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithArrayInput")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
@@ -52,9 +43,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def createUsersWithListInput(body: Option[List[User]] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
def createUsersWithListInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/createWithList"))
|
||||
|
||||
@@ -62,11 +51,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithListInput")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
@@ -74,97 +61,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def loginUser(username: Option[String] = None,
|
||||
password: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[String]): Future[String] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/login"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
if(username != null) username.foreach { v => queryParams += "username" -> v.toString }if(password != null) password.foreach { v => queryParams += "password" -> v.toString }
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/logout"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def updateUser(username: String,
|
||||
body: Option[User] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
@@ -174,11 +70,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
@@ -186,6 +78,79 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def loginUser(username: String,
|
||||
password: String)(implicit reader: ClientResponseReader[String]): Future[String] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/login"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (username != null) queryParams += "username" -> username.toString
|
||||
|
||||
if (password != null) queryParams += "password" -> password.toString
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/logout"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def updateUser(username: String,
|
||||
body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->updateUser")
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class ApiResponse (
|
||||
code: Option[Integer],
|
||||
_type: Option[String],
|
||||
message: Option[String]
|
||||
)
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
shipDate: DateTime,
|
||||
status: String, // Order Status
|
||||
complete: Boolean
|
||||
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
||||
quantity: Option[Integer],
|
||||
shipDate: Option[DateTime],
|
||||
status: Option[String], // Order Status
|
||||
complete: Option[Boolean]
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String // pet status in the store
|
||||
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: Option[List[Tag]],
|
||||
status: Option[String] // pet status in the store
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Integer // User Status
|
||||
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
||||
firstName: Option[String],
|
||||
lastName: Option[String],
|
||||
email: Option[String],
|
||||
password: Option[String],
|
||||
phone: Option[String],
|
||||
userStatus: Option[Integer] // User Status
|
||||
)
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import io.swagger.client._
|
||||
import io.swagger.client.api._
|
||||
import io.swagger.client.model._
|
||||
|
||||
import java.net.URI
|
||||
|
||||
import scala.concurrent._
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.{Failure, Success}
|
||||
import org.scalatest._
|
||||
import org.junit.runner.RunWith
|
||||
import org.scalatest.junit.JUnitRunner
|
||||
import org.scalatest.FunSuite
|
||||
import com.wordnik.swagger._
|
||||
com.wordnik.swagger.client
|
||||
|
||||
@RunWith(classOf[JUnitRunner])
|
||||
class SimpleTest extends FlatSpec with Matchers {
|
||||
@@ -24,4 +34,4 @@ class SimpleTest extends FlatSpec with Matchers {
|
||||
case Failure(t) => println("failed " + t.getMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using IO.Swagger.Api;
|
||||
using IO.Swagger.Model;
|
||||
using IO.Swagger.Client;
|
||||
using System.Reflection;
|
||||
|
||||
namespace IO.Swagger.Test
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for testing ApiResponse
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This file is automatically generated by Swagger Codegen.
|
||||
/// Please update the test case below to test the model.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public class ApiResponseTests
|
||||
{
|
||||
private ApiResponse instance;
|
||||
|
||||
/// <summary>
|
||||
/// Setup before each test
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
instance = new ApiResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up after each test
|
||||
/// </summary>
|
||||
[TearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test an instance of ApiResponse
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ApiResponseInstanceTest()
|
||||
{
|
||||
Assert.IsInstanceOf<ApiResponse> (instance, "instance is a ApiResponse");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the property 'Code'
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void CodeTest()
|
||||
{
|
||||
// TODO: unit test for the property 'Code'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property 'Type'
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TypeTest()
|
||||
{
|
||||
// TODO: unit test for the property 'Type'
|
||||
}
|
||||
/// <summary>
|
||||
/// Test the property 'Message'
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void MessageTest()
|
||||
{
|
||||
// TODO: unit test for the property 'Message'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
27
samples/client/petstore/dart/.gitignore
vendored
Normal file
27
samples/client/petstore/dart/.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# See https://www.dartlang.org/tools/private-files.html
|
||||
|
||||
# Files and directories created by pub
|
||||
.buildlog
|
||||
.packages
|
||||
.project
|
||||
.pub/
|
||||
build/
|
||||
**/packages/
|
||||
|
||||
# Files created by dart2js
|
||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
||||
# rules if you intend to use dart2js directly
|
||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
||||
# differentiate from explicit Javascript files)
|
||||
*.dart.js
|
||||
*.part.js
|
||||
*.js.deps
|
||||
*.js.map
|
||||
*.info.json
|
||||
|
||||
# Directory created by dartdoc
|
||||
doc/api/
|
||||
|
||||
# Don't commit pubspec lock file
|
||||
# (Library packages only! Remove pattern if developing an application package)
|
||||
pubspec.lock
|
||||
52
samples/client/petstore/dart/git_push.sh
Normal file
52
samples/client/petstore/dart/git_push.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="YOUR_GIT_USR_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="YOUR_GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
||||
@@ -16,12 +16,14 @@ part 'auth/api_key_auth.dart';
|
||||
part 'auth/oauth.dart';
|
||||
part 'auth/http_basic_auth.dart';
|
||||
|
||||
part 'api/user_api.dart';
|
||||
part 'api/store_api.dart';
|
||||
part 'api/pet_api.dart';
|
||||
part 'api/store_api.dart';
|
||||
part 'api/user_api.dart';
|
||||
|
||||
part 'model/user.dart';
|
||||
part 'model/api_response.dart';
|
||||
part 'model/category.dart';
|
||||
part 'model/order.dart';
|
||||
part 'model/pet.dart';
|
||||
part 'model/tag.dart';
|
||||
part 'model/order.dart';
|
||||
part 'model/user.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
part of api;
|
||||
|
||||
|
||||
|
||||
class PetApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiClient apiClient = ApiClient.defaultApiClient;
|
||||
@@ -12,59 +11,15 @@ class PetApi {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Update an existing pet
|
||||
///
|
||||
///
|
||||
Future updatePet(Pet body) {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = ["application/json","application/xml"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Add a new pet to the store
|
||||
///
|
||||
///
|
||||
Future addPet(Pet body) {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("{format}","json");
|
||||
@@ -73,9 +28,7 @@ class PetApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = ["application/json","application/xml"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -89,8 +42,7 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -104,13 +56,64 @@ class PetApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Deletes a pet
|
||||
///
|
||||
///
|
||||
Future deletePet(int petId, String apiKey) {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
headerParams["api_key"] = apiKey;
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Finds Pets by status
|
||||
///
|
||||
/// Multiple status values can be provided with comma seperated strings
|
||||
/// Multiple status values can be provided with comma separated strings
|
||||
Future<List<Pet>> findPetsByStatus(List<String> status) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("{format}","json");
|
||||
@@ -122,8 +125,6 @@ class PetApi {
|
||||
if("null" != status)
|
||||
queryParams["status"] = status is List ? status.join(',') : status;
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -137,8 +138,7 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -152,13 +152,15 @@ class PetApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Finds Pets by tags
|
||||
///
|
||||
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
Future<List<Pet>> findPetsByTags(List<String> tags) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("{format}","json");
|
||||
@@ -170,8 +172,6 @@ class PetApi {
|
||||
if("null" != tags)
|
||||
queryParams["tags"] = tags is List ? tags.join(',') : tags;
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -185,8 +185,7 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -200,13 +199,15 @@ class PetApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Find pet by ID
|
||||
///
|
||||
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
/// Returns a single pet
|
||||
Future<Pet> getPetById(int petId) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
@@ -215,13 +216,11 @@ class PetApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth", "api_key"];
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
@@ -231,8 +230,7 @@ class PetApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -246,13 +244,66 @@ class PetApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Update an existing pet
|
||||
///
|
||||
///
|
||||
Future updatePet(Pet body) {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = ["application/json","application/xml"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Updates a pet in the store with form data
|
||||
///
|
||||
///
|
||||
Future updatePetWithForm(String petId, String name, String status) {
|
||||
Future updatePetWithForm(int petId, String name, String status) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
@@ -261,9 +312,7 @@ class PetApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = ["application/x-www-form-urlencoded"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -289,9 +338,8 @@ class PetApi {
|
||||
else {
|
||||
if (name != null)
|
||||
formParams['name'] = apiClient.parameterToString(name);
|
||||
if (status != null)
|
||||
if (status != null)
|
||||
formParams['status'] = apiClient.parameterToString(status);
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
@@ -306,60 +354,21 @@ class PetApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Deletes a pet
|
||||
///
|
||||
///
|
||||
Future deletePet(int petId, String apiKey) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
headerParams["api_key"] = apiKey;
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["petstore_auth"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// uploads an image
|
||||
///
|
||||
///
|
||||
Future uploadFile(int petId, String additionalMetadata, MultipartFile file) {
|
||||
Future<ApiResponse> uploadFile(int petId, String additionalMetadata, MultipartFile file) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
|
||||
@@ -368,9 +377,7 @@ class PetApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = ["multipart/form-data"];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -397,8 +404,7 @@ class PetApi {
|
||||
else {
|
||||
if (additionalMetadata != null)
|
||||
formParams['additionalMetadata'] = apiClient.parameterToString(additionalMetadata);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
@@ -406,13 +412,11 @@ class PetApi {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
return ApiClient.deserialize(response.body, ApiResponse);
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
part of api;
|
||||
|
||||
|
||||
|
||||
class StoreApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiClient apiClient = ApiClient.defaultApiClient;
|
||||
@@ -12,151 +11,15 @@ class StoreApi {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Returns pet inventories by status
|
||||
///
|
||||
/// Returns a map of status codes to quantities
|
||||
Future<Map<String, int>> getInventory() {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/inventory".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Map);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Place an order for a pet
|
||||
///
|
||||
///
|
||||
Future<Order> placeOrder(Order body) {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Order);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Find purchase order by ID
|
||||
///
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
Future<Order> getOrderById(String orderId) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Order);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Delete purchase order by ID
|
||||
///
|
||||
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
Future deleteOrder(String orderId) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
||||
@@ -165,9 +28,7 @@ class StoreApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -181,8 +42,7 @@ class StoreApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -196,6 +56,136 @@ class StoreApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
/// Returns pet inventories by status
|
||||
///
|
||||
/// Returns a map of status codes to quantities
|
||||
Future<Map<String, int>> getInventory() {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/inventory".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = ["api_key"];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Map);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Find purchase order by ID
|
||||
///
|
||||
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
Future<Order> getOrderById(int orderId) {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Order);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Place an order for a pet
|
||||
///
|
||||
///
|
||||
Future<Order> placeOrder(Order body) {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, Order);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
part of api;
|
||||
|
||||
|
||||
|
||||
class UserApi {
|
||||
String basePath = "http://petstore.swagger.io/v2";
|
||||
ApiClient apiClient = ApiClient.defaultApiClient;
|
||||
@@ -12,13 +11,15 @@ class UserApi {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Create user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future createUser(User body) {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user".replaceAll("{format}","json");
|
||||
@@ -27,9 +28,7 @@ class UserApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -43,8 +42,7 @@ class UserApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -58,13 +56,15 @@ class UserApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
Future createUsersWithArrayInput(List<User> body) {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("{format}","json");
|
||||
@@ -73,9 +73,7 @@ class UserApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -89,8 +87,7 @@ class UserApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -104,13 +101,15 @@ class UserApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Creates list of users with given input array
|
||||
///
|
||||
///
|
||||
Future createUsersWithListInput(List<User> body) {
|
||||
Object postBody = body;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("{format}","json");
|
||||
@@ -119,9 +118,7 @@ class UserApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -135,8 +132,7 @@ class UserApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -150,201 +146,15 @@ class UserApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Logs user into the system
|
||||
///
|
||||
///
|
||||
Future<String> loginUser(String username, String password) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
if("null" != username)
|
||||
queryParams["username"] = username is List ? username.join(',') : username;
|
||||
if("null" != password)
|
||||
queryParams["password"] = password is List ? password.join(',') : password;
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, String);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
///
|
||||
Future logoutUser() {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/logout".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Get user by user name
|
||||
///
|
||||
///
|
||||
Future<User> getUserByName(String username) {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, User);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Updated user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future updateUser(String username, User body) {
|
||||
Object postBody = body;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Delete user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future deleteUser(String username) {
|
||||
Object postBody = null;
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
@@ -353,9 +163,7 @@ class UserApi {
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
|
||||
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
@@ -369,8 +177,7 @@ class UserApi {
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
@@ -384,6 +191,191 @@ class UserApi {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
/// Get user by user name
|
||||
///
|
||||
///
|
||||
Future<User> getUserByName(String username) {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, User);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Logs user into the system
|
||||
///
|
||||
///
|
||||
Future<String> loginUser(String username, String password) {
|
||||
Object postBody = null;
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
if("null" != username)
|
||||
queryParams["username"] = username is List ? username.join(',') : username;
|
||||
if("null" != password)
|
||||
queryParams["password"] = password is List ? password.join(',') : password;
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ApiClient.deserialize(response.body, String);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Logs out current logged in user session
|
||||
///
|
||||
///
|
||||
Future logoutUser() {
|
||||
Object postBody = null;
|
||||
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/logout".replaceAll("{format}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
/// Updated user
|
||||
///
|
||||
/// This can only be done by the logged in user.
|
||||
Future updateUser(String username, User body) {
|
||||
Object postBody = body;
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = {};
|
||||
Map<String, String> headerParams = {};
|
||||
Map<String, String> formParams = {};
|
||||
|
||||
List<String> contentTypes = [];
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
List<String> authNames = [];
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
bool hasFields = false;
|
||||
MultipartRequest mp = new MultipartRequest(null, null);
|
||||
|
||||
if(hasFields)
|
||||
postBody = mp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
|
||||
if(response.statusCode >= 400) {
|
||||
throw new ApiException(response.statusCode, response.body);
|
||||
}
|
||||
else if(response.body != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,32 +61,18 @@ class ApiClient {
|
||||
bool isMap = json is Map;
|
||||
|
||||
switch(clazz) {
|
||||
|
||||
|
||||
case User:
|
||||
return isMap ? dson.map(json, new User()) : dson.decode(json, new User());
|
||||
|
||||
|
||||
|
||||
case ApiResponse:
|
||||
return isMap ? dson.map(json, new ApiResponse()) : dson.decode(json, new ApiResponse());
|
||||
case Category:
|
||||
return isMap ? dson.map(json, new Category()) : dson.decode(json, new Category());
|
||||
|
||||
|
||||
|
||||
case Pet:
|
||||
return isMap ? dson.map(json, new Pet()) : dson.decode(json, new Pet());
|
||||
|
||||
|
||||
|
||||
case Tag:
|
||||
return isMap ? dson.map(json, new Tag()) : dson.decode(json, new Tag());
|
||||
|
||||
|
||||
|
||||
case Order:
|
||||
return isMap ? dson.map(json, new Order()) : dson.decode(json, new Order());
|
||||
|
||||
|
||||
case Pet:
|
||||
return isMap ? dson.map(json, new Pet()) : dson.decode(json, new Pet());
|
||||
case Tag:
|
||||
return isMap ? dson.map(json, new Tag()) : dson.decode(json, new Tag());
|
||||
case User:
|
||||
return isMap ? dson.map(json, new User()) : dson.decode(json, new User());
|
||||
default:
|
||||
throw new ApiException(500, 'Could not find a suitable class for deserialization');
|
||||
}
|
||||
|
||||
23
samples/client/petstore/dart/lib/model/api_response.dart
Normal file
23
samples/client/petstore/dart/lib/model/api_response.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
part of api;
|
||||
|
||||
|
||||
@Entity()
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
|
||||
|
||||
String type = null;
|
||||
|
||||
|
||||
String message = null;
|
||||
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ApiResponse[code=$code, type=$type, message=$message, ]';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ class Category {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
|
||||
Category();
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,22 +6,21 @@ class Order {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
|
||||
int petId = null;
|
||||
|
||||
|
||||
|
||||
int quantity = null;
|
||||
|
||||
|
||||
|
||||
DateTime shipDate = null;
|
||||
|
||||
/* Order Status */
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };
|
||||
|
||||
|
||||
bool complete = null;
|
||||
|
||||
|
||||
Order();
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,22 +6,21 @@ class Pet {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
|
||||
Category category = null;
|
||||
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
|
||||
|
||||
List<String> photoUrls = [];
|
||||
|
||||
|
||||
|
||||
List<Tag> tags = [];
|
||||
|
||||
/* pet status in the store */
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };
|
||||
|
||||
Pet();
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,10 +6,9 @@ class Tag {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
|
||||
String name = null;
|
||||
|
||||
|
||||
Tag();
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,28 +6,27 @@ class User {
|
||||
|
||||
int id = null;
|
||||
|
||||
|
||||
|
||||
String username = null;
|
||||
|
||||
|
||||
|
||||
String firstName = null;
|
||||
|
||||
|
||||
|
||||
String lastName = null;
|
||||
|
||||
|
||||
|
||||
String email = null;
|
||||
|
||||
|
||||
|
||||
String password = null;
|
||||
|
||||
|
||||
|
||||
String phone = null;
|
||||
|
||||
/* User Status */
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
|
||||
|
||||
User();
|
||||
|
||||
@override
|
||||
|
||||
1
samples/client/petstore/dart/test/packages
Symbolic link
1
samples/client/petstore/dart/test/packages
Symbolic link
@@ -0,0 +1 @@
|
||||
../packages
|
||||
11
samples/client/petstore/flash/.gitignore
vendored
Normal file
11
samples/client/petstore/flash/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Build and Release Folders
|
||||
bin/
|
||||
bin-debug/
|
||||
bin-release/
|
||||
|
||||
# Other files and folders
|
||||
.settings/
|
||||
|
||||
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
|
||||
# should NOT be excluded as they contain compiler settings and other important
|
||||
# information for Eclipse / Flash Builder.
|
||||
@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
|
||||
import io.swagger.event.Response;
|
||||
import io.swagger.common.SwaggerApi;
|
||||
import io.swagger.client.model.Pet;
|
||||
import io.swagger.client.model.InlineResponse200;
|
||||
import flash.filesystem.File;
|
||||
|
||||
import mx.rpc.AsyncToken;
|
||||
@@ -24,47 +25,19 @@ public class PetApi extends SwaggerApi {
|
||||
super(apiCredentials, eventDispatcher);
|
||||
}
|
||||
|
||||
public static const event_update_pet: String = "update_pet";
|
||||
public static const event_add_pet: String = "add_pet";
|
||||
public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array";
|
||||
public static const event_delete_pet: String = "delete_pet";
|
||||
public static const event_find_pets_by_status: String = "find_pets_by_status";
|
||||
public static const event_find_pets_by_tags: String = "find_pets_by_tags";
|
||||
public static const event_get_pet_by_id: String = "get_pet_by_id";
|
||||
public static const event_get_pet_by_id_in_object: String = "get_pet_by_id_in_object";
|
||||
public static const event_pet_pet_idtesting_byte_arraytrue_get: String = "pet_pet_idtesting_byte_arraytrue_get";
|
||||
public static const event_update_pet: String = "update_pet";
|
||||
public static const event_update_pet_with_form: String = "update_pet_with_form";
|
||||
public static const event_delete_pet: String = "delete_pet";
|
||||
public static const event_upload_file: String = "upload_file";
|
||||
public static const event_get_pet_by_id_with_byte_array: String = "get_pet_by_id_with_byte_array";
|
||||
public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array";
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_pet (body: Pet): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_pet";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -76,12 +49,13 @@ public class PetApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -93,127 +67,37 @@ public class PetApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Array
|
||||
*/
|
||||
public function find_pets_by_status (status: Array): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/findByStatus".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
if("null" != String(status))
|
||||
queryParams["status"] = toPathValue(status);
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "find_pets_by_status";
|
||||
|
||||
token.returnType = Array;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Array
|
||||
*/
|
||||
public function find_pets_by_tags (tags: Array): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/findByTags".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
if("null" != String(tags))
|
||||
queryParams["tags"] = toPathValue(tags);
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "find_pets_by_tags";
|
||||
|
||||
token.returnType = Array;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Pet
|
||||
*/
|
||||
public function get_pet_by_id (petId: Number): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_pet_by_id";
|
||||
|
||||
token.returnType = Pet;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_pet_with_form (petId: String, name: String, status: String): String {
|
||||
public function add_pet_using_byte_array (body: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
var path: String = "/pet?testing_byte_array=true".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_pet_with_form";
|
||||
token.completionEventType = "add_pet_using_byte_array";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -225,12 +109,17 @@ public class PetApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
headerParams["apiKey"] = toPathValue(apiKey);
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
|
||||
|
||||
@@ -243,7 +132,229 @@ public class PetApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns Array
|
||||
*/
|
||||
public function find_pets_by_status (status: Array): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/findByStatus".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
if("null" != String(status))
|
||||
queryParams["status"] = toPathValue(status);
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "find_pets_by_status";
|
||||
|
||||
token.returnType = Array;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Array
|
||||
*/
|
||||
public function find_pets_by_tags (tags: Array): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/findByTags".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
if("null" != String(tags))
|
||||
queryParams["tags"] = toPathValue(tags);
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "find_pets_by_tags";
|
||||
|
||||
token.returnType = Array;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Pet
|
||||
*/
|
||||
public function get_pet_by_id (petId: Number): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_pet_by_id";
|
||||
|
||||
token.returnType = Pet;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns InlineResponse200
|
||||
*/
|
||||
public function get_pet_by_id_in_object (petId: Number): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}?response=inline_arbitrary_object".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_pet_by_id_in_object";
|
||||
|
||||
token.returnType = InlineResponse200;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns String
|
||||
*/
|
||||
public function pet_pet_idtesting_byte_arraytrue_get (petId: Number): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}?testing_byte_array=true".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "pet_pet_idtesting_byte_arraytrue_get";
|
||||
|
||||
token.returnType = String;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_pet (body: Pet): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_pet";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_pet_with_form (petId: String, name: String, status: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_pet_with_form";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -255,12 +366,21 @@ public class PetApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -272,65 +392,5 @@ public class PetApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns String
|
||||
*/
|
||||
public function get_pet_by_id_with_byte_array (petId: Number): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet/{petId}?testing_byte_array=true".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_pet_by_id_with_byte_array";
|
||||
|
||||
token.returnType = String;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function add_pet_using_byte_array (body: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/pet?testing_byte_array=true".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "add_pet_using_byte_array";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
|
||||
import io.swagger.event.Response;
|
||||
import io.swagger.common.SwaggerApi;
|
||||
import io.swagger.client.model.Order;
|
||||
import io.swagger.client.model.Object;
|
||||
|
||||
import mx.rpc.AsyncToken;
|
||||
import mx.utils.UIDUtil;
|
||||
@@ -23,12 +24,76 @@ public class StoreApi extends SwaggerApi {
|
||||
super(apiCredentials, eventDispatcher);
|
||||
}
|
||||
|
||||
public static const event_get_inventory: String = "get_inventory";
|
||||
public static const event_place_order: String = "place_order";
|
||||
public static const event_get_order_by_id: String = "get_order_by_id";
|
||||
public static const event_delete_order: String = "delete_order";
|
||||
public static const event_find_orders_by_status: String = "find_orders_by_status";
|
||||
public static const event_get_inventory: String = "get_inventory";
|
||||
public static const event_get_inventory_in_object: String = "get_inventory_in_object";
|
||||
public static const event_get_order_by_id: String = "get_order_by_id";
|
||||
public static const event_place_order: String = "place_order";
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function delete_order (orderId: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "delete_order";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Array
|
||||
*/
|
||||
public function find_orders_by_status (status: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/store/findByStatus".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
if("null" != String(status))
|
||||
queryParams["status"] = toPathValue(status);
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "find_orders_by_status";
|
||||
|
||||
token.returnType = Array;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns Dictionary
|
||||
*/
|
||||
@@ -40,12 +105,9 @@ public class StoreApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -57,36 +119,33 @@ public class StoreApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns Order
|
||||
* Returns Object
|
||||
*/
|
||||
public function place_order (body: Order): String {
|
||||
public function get_inventory_in_object (): String {
|
||||
// create path and map variables
|
||||
var path: String = "/store/order".replace(/{format}/g,"xml");
|
||||
var path: String = "/store/inventory?response=arbitrary_object".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "place_order";
|
||||
token.completionEventType = "get_inventory_in_object";
|
||||
|
||||
token.returnType = Order;
|
||||
token.returnType = Object;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns Order
|
||||
*/
|
||||
@@ -98,12 +157,13 @@ public class StoreApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -115,36 +175,35 @@ public class StoreApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
* Returns Order
|
||||
*/
|
||||
public function delete_order (orderId: String): String {
|
||||
public function place_order (body: Order): String {
|
||||
// create path and map variables
|
||||
var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
|
||||
var path: String = "/store/order".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "delete_order";
|
||||
token.completionEventType = "place_order";
|
||||
|
||||
token.returnType = null ;
|
||||
token.returnType = Order;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ public class UserApi extends SwaggerApi {
|
||||
public static const event_create_user: String = "create_user";
|
||||
public static const event_create_users_with_array_input: String = "create_users_with_array_input";
|
||||
public static const event_create_users_with_list_input: String = "create_users_with_list_input";
|
||||
public static const event_delete_user: String = "delete_user";
|
||||
public static const event_get_user_by_name: String = "get_user_by_name";
|
||||
public static const event_login_user: String = "login_user";
|
||||
public static const event_logout_user: String = "logout_user";
|
||||
public static const event_get_user_by_name: String = "get_user_by_name";
|
||||
public static const event_update_user: String = "update_user";
|
||||
public static const event_delete_user: String = "delete_user";
|
||||
|
||||
|
||||
/*
|
||||
@@ -44,12 +44,13 @@ public class UserApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -61,7 +62,7 @@ public class UserApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -73,12 +74,13 @@ public class UserApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -90,7 +92,7 @@ public class UserApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -102,12 +104,13 @@ public class UserApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -119,127 +122,7 @@ public class UserApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns String
|
||||
*/
|
||||
public function login_user (username: String, password: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/login".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
if("null" != String(username))
|
||||
queryParams["username"] = toPathValue(username);
|
||||
if("null" != String(password))
|
||||
queryParams["password"] = toPathValue(password);
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "login_user";
|
||||
|
||||
token.returnType = String;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function logout_user (): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/logout".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "logout_user";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns User
|
||||
*/
|
||||
public function get_user_by_name (username: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_user_by_name";
|
||||
|
||||
token.returnType = User;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_user (username: String, body: User): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_user";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
@@ -251,12 +134,13 @@ public class UserApi extends SwaggerApi {
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
@@ -268,7 +152,133 @@ public class UserApi extends SwaggerApi {
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns User
|
||||
*/
|
||||
public function get_user_by_name (username: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "get_user_by_name";
|
||||
|
||||
token.returnType = User;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns String
|
||||
*/
|
||||
public function login_user (username: String, password: String): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/login".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
if("null" != String(username))
|
||||
queryParams["username"] = toPathValue(username);
|
||||
if("null" != String(password))
|
||||
queryParams["password"] = toPathValue(password);
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "login_user";
|
||||
|
||||
token.returnType = String;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function logout_user (): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/logout".replace(/{format}/g,"xml");
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "logout_user";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns void
|
||||
*/
|
||||
public function update_user (username: String, body: User): String {
|
||||
// create path and map variables
|
||||
var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
|
||||
|
||||
// query params
|
||||
var queryParams: Dictionary = new Dictionary();
|
||||
var headerParams: Dictionary = new Dictionary();
|
||||
|
||||
// verify required params are set
|
||||
if( // verify required params are set
|
||||
if() {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
) {
|
||||
throw new ApiError(400, "missing required params");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams);
|
||||
|
||||
var requestId: String = getUniqueId();
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "update_user";
|
||||
|
||||
token.returnType = null ;
|
||||
return requestId;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
|
||||
[XmlRootNode(name="200Response")]
|
||||
public class 200Response {
|
||||
[XmlElement(name="name")]
|
||||
public var name: Number = 0;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "200Response: ";
|
||||
str += " (name: " + name + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
|
||||
public class 200ResponseList implements ListWrapper {
|
||||
// This declaration below of _200_response_obj_class is to force flash compiler to include this class
|
||||
private var _200Response__obj_class: io.swagger.client.model.200Response = null;
|
||||
[XmlElements(name="200Response_", type="io.swagger.client.model.200Response")]
|
||||
public var 200Response_: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return 200Response_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
|
||||
[XmlRootNode(name="Animal")]
|
||||
public class Animal {
|
||||
[XmlElement(name="className")]
|
||||
public var className: String = null;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Animal: ";
|
||||
str += " (className: " + className + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
|
||||
public class AnimalList implements ListWrapper {
|
||||
// This declaration below of _Animal_obj_class is to force flash compiler to include this class
|
||||
private var _animal_obj_class: io.swagger.client.model.Animal = null;
|
||||
[XmlElements(name="animal", type="io.swagger.client.model.Animal")]
|
||||
public var animal: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return animal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
[XmlRootNode(name="Cat")]
|
||||
public class Cat {
|
||||
[XmlElement(name="className")]
|
||||
public var className: String = null;
|
||||
[XmlElement(name="declawed")]
|
||||
public var declawed: Boolean = false;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Cat: ";
|
||||
str += " (className: " + className + ")";
|
||||
str += " (declawed: " + declawed + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
public class CatList implements ListWrapper {
|
||||
// This declaration below of _Cat_obj_class is to force flash compiler to include this class
|
||||
private var _cat_obj_class: io.swagger.client.model.Cat = null;
|
||||
[XmlElements(name="cat", type="io.swagger.client.model.Cat")]
|
||||
public var cat: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return cat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,27 +3,15 @@ package io.swagger.client.model {
|
||||
|
||||
[XmlRootNode(name="Category")]
|
||||
public class Category {
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="id")]
|
||||
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="name")]
|
||||
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Category: ";
|
||||
|
||||
str += " (id: " + id + ")";
|
||||
|
||||
str += " (name: " + name + ")";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
[XmlRootNode(name="Dog")]
|
||||
public class Dog {
|
||||
[XmlElement(name="className")]
|
||||
public var className: String = null;
|
||||
[XmlElement(name="breed")]
|
||||
public var breed: String = null;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Dog: ";
|
||||
str += " (className: " + className + ")";
|
||||
str += " (breed: " + breed + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
public class DogList implements ListWrapper {
|
||||
// This declaration below of _Dog_obj_class is to force flash compiler to include this class
|
||||
private var _dog_obj_class: io.swagger.client.model.Dog = null;
|
||||
[XmlElements(name="dog", type="io.swagger.client.model.Dog")]
|
||||
public var dog: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return dog;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.client.model.ByteArray;
|
||||
|
||||
[XmlRootNode(name="FormatTest")]
|
||||
public class FormatTest {
|
||||
[XmlElement(name="integer")]
|
||||
public var integer: Number = NaN;
|
||||
[XmlElement(name="int32")]
|
||||
public var int32: Number = 0;
|
||||
[XmlElement(name="int64")]
|
||||
public var int64: Number = 0;
|
||||
[XmlElement(name="number")]
|
||||
public var number: Number = NaN;
|
||||
[XmlElement(name="float")]
|
||||
public var float: Number = 0.0;
|
||||
[XmlElement(name="double")]
|
||||
public var double: Number = 0.0;
|
||||
[XmlElement(name="string")]
|
||||
public var string: String = null;
|
||||
[XmlElement(name="byte")]
|
||||
public var byte: ByteArray = NaN;
|
||||
[XmlElement(name="binary")]
|
||||
public var binary: String = NaN;
|
||||
[XmlElement(name="date")]
|
||||
public var date: Date = null;
|
||||
[XmlElement(name="dateTime")]
|
||||
public var dateTime: Date = null;
|
||||
[XmlElement(name="password")]
|
||||
public var password: String = null;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "FormatTest: ";
|
||||
str += " (integer: " + integer + ")";
|
||||
str += " (int32: " + int32 + ")";
|
||||
str += " (int64: " + int64 + ")";
|
||||
str += " (number: " + number + ")";
|
||||
str += " (float: " + float + ")";
|
||||
str += " (double: " + double + ")";
|
||||
str += " (string: " + string + ")";
|
||||
str += " (byte: " + byte + ")";
|
||||
str += " (binary: " + binary + ")";
|
||||
str += " (date: " + date + ")";
|
||||
str += " (dateTime: " + dateTime + ")";
|
||||
str += " (password: " + password + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
import io.swagger.client.model.ByteArray;
|
||||
|
||||
public class FormatTestList implements ListWrapper {
|
||||
// This declaration below of _format_test_obj_class is to force flash compiler to include this class
|
||||
private var _formatTest_obj_class: io.swagger.client.model.FormatTest = null;
|
||||
[XmlElements(name="formatTest", type="io.swagger.client.model.FormatTest")]
|
||||
public var formatTest: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return formatTest;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.client.model.Object;
|
||||
import io.swagger.client.model.Tag;
|
||||
|
||||
[XmlRootNode(name="InlineResponse200")]
|
||||
public class InlineResponse200 {
|
||||
// This declaration below of _tags_obj_class is to force flash compiler to include this class
|
||||
private var _tags_obj_class: Array = null;
|
||||
[XmlElementWrapper(name="tags")]
|
||||
[XmlElements(name="tags", type="Array")]
|
||||
public var tags: Array = new Array();
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
[XmlElement(name="category")]
|
||||
public var category: Object = NaN;
|
||||
/* pet status in the store */
|
||||
[XmlElement(name="status")]
|
||||
public var status: String = null;
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
|
||||
private var _photoUrls_obj_class: Array = null;
|
||||
[XmlElementWrapper(name="photoUrls")]
|
||||
[XmlElements(name="photoUrls", type="Array")]
|
||||
public var photoUrls: Array = new Array();
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "InlineResponse200: ";
|
||||
str += " (tags: " + tags + ")";
|
||||
str += " (id: " + id + ")";
|
||||
str += " (category: " + category + ")";
|
||||
str += " (status: " + status + ")";
|
||||
str += " (name: " + name + ")";
|
||||
str += " (photoUrls: " + photoUrls + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
import io.swagger.client.model.Object;
|
||||
import io.swagger.client.model.Tag;
|
||||
|
||||
public class InlineResponse200List implements ListWrapper {
|
||||
// This declaration below of _inline_response_200_obj_class is to force flash compiler to include this class
|
||||
private var _inlineResponse200_obj_class: io.swagger.client.model.InlineResponse200 = null;
|
||||
[XmlElements(name="inlineResponse200", type="io.swagger.client.model.InlineResponse200")]
|
||||
public var inlineResponse200: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return inlineResponse200;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
|
||||
[XmlRootNode(name="ModelReturn")]
|
||||
public class ModelReturn {
|
||||
[XmlElement(name="return")]
|
||||
public var return_: Number = 0;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "ModelReturn: ";
|
||||
str += " (return_: " + return_ + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
|
||||
public class ModelReturnList implements ListWrapper {
|
||||
// This declaration below of _Return_obj_class is to force flash compiler to include this class
|
||||
private var _return__obj_class: io.swagger.client.model.ModelReturn = null;
|
||||
[XmlElements(name="return_", type="io.swagger.client.model.ModelReturn")]
|
||||
public var return_: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return return_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
|
||||
[XmlRootNode(name="Name")]
|
||||
public class Name {
|
||||
[XmlElement(name="name")]
|
||||
public var name: Number = 0;
|
||||
[XmlElement(name="snake_case")]
|
||||
public var snakeCase: Number = 0;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Name: ";
|
||||
str += " (name: " + name + ")";
|
||||
str += " (snakeCase: " + snakeCase + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
|
||||
public class NameList implements ListWrapper {
|
||||
// This declaration below of _Name_obj_class is to force flash compiler to include this class
|
||||
private var _name_obj_class: io.swagger.client.model.Name = null;
|
||||
[XmlElements(name="name", type="io.swagger.client.model.Name")]
|
||||
public var name: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,60 +3,28 @@ package io.swagger.client.model {
|
||||
|
||||
[XmlRootNode(name="Order")]
|
||||
public class Order {
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="id")]
|
||||
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="petId")]
|
||||
|
||||
[XmlElement(name="petId")]
|
||||
public var petId: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="quantity")]
|
||||
|
||||
[XmlElement(name="quantity")]
|
||||
public var quantity: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="shipDate")]
|
||||
|
||||
[XmlElement(name="shipDate")]
|
||||
public var shipDate: Date = null;
|
||||
|
||||
/* Order Status */
|
||||
|
||||
|
||||
[XmlElement(name="status")]
|
||||
|
||||
public var status: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="complete")]
|
||||
|
||||
[XmlElement(name="complete")]
|
||||
public var complete: Boolean = false;
|
||||
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Order: ";
|
||||
|
||||
str += " (id: " + id + ")";
|
||||
|
||||
str += " (petId: " + petId + ")";
|
||||
|
||||
str += " (quantity: " + quantity + ")";
|
||||
|
||||
str += " (shipDate: " + shipDate + ")";
|
||||
|
||||
str += " (status: " + status + ")";
|
||||
|
||||
str += " (complete: " + complete + ")";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,68 +5,34 @@ import io.swagger.client.model.Tag;
|
||||
|
||||
[XmlRootNode(name="Pet")]
|
||||
public class Pet {
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="id")]
|
||||
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="category")]
|
||||
|
||||
[XmlElement(name="category")]
|
||||
public var category: Category = NaN;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="name")]
|
||||
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
|
||||
|
||||
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
|
||||
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
|
||||
private var _photoUrls_obj_class: Array = null;
|
||||
[XmlElementWrapper(name="photoUrls")]
|
||||
[XmlElements(name="photoUrls", type="Array")]
|
||||
|
||||
|
||||
public var photoUrls: Array = new Array();
|
||||
|
||||
|
||||
|
||||
// This declaration below of _tags_obj_class is to force flash compiler to include this class
|
||||
public var photoUrls: Array = new Array();
|
||||
// This declaration below of _tags_obj_class is to force flash compiler to include this class
|
||||
private var _tags_obj_class: Array = null;
|
||||
[XmlElementWrapper(name="tags")]
|
||||
[XmlElements(name="tags", type="Array")]
|
||||
|
||||
|
||||
public var tags: Array = new Array();
|
||||
|
||||
public var tags: Array = new Array();
|
||||
/* pet status in the store */
|
||||
|
||||
|
||||
[XmlElement(name="status")]
|
||||
|
||||
public var status: String = null;
|
||||
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Pet: ";
|
||||
|
||||
str += " (id: " + id + ")";
|
||||
|
||||
str += " (category: " + category + ")";
|
||||
|
||||
str += " (name: " + name + ")";
|
||||
|
||||
str += " (photoUrls: " + photoUrls + ")";
|
||||
|
||||
str += " (tags: " + tags + ")";
|
||||
|
||||
str += " (status: " + status + ")";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,5 @@ import io.swagger.client.model.Tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
|
||||
[XmlRootNode(name="SpecialModelName")]
|
||||
public class SpecialModelName {
|
||||
[XmlElement(name="$special[property.name]")]
|
||||
public var $Special[propertyName]: Number = 0;
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "SpecialModelName: ";
|
||||
str += " ($Special[propertyName]: " + $Special[propertyName] + ")";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package io.swagger.client.model {
|
||||
|
||||
import io.swagger.common.ListWrapper;
|
||||
|
||||
public class SpecialModelNameList implements ListWrapper {
|
||||
// This declaration below of _$special[model.name]_obj_class is to force flash compiler to include this class
|
||||
private var _$Special[modelName]_obj_class: io.swagger.client.model.SpecialModelName = null;
|
||||
[XmlElements(name="$Special[modelName]", type="io.swagger.client.model.SpecialModelName")]
|
||||
public var $Special[modelName]: Array = new Array();
|
||||
|
||||
public function getList(): Array{
|
||||
return $Special[modelName];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,27 +3,15 @@ package io.swagger.client.model {
|
||||
|
||||
[XmlRootNode(name="Tag")]
|
||||
public class Tag {
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="id")]
|
||||
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="name")]
|
||||
|
||||
[XmlElement(name="name")]
|
||||
public var name: String = null;
|
||||
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "Tag: ";
|
||||
|
||||
str += " (id: " + id + ")";
|
||||
|
||||
str += " (name: " + name + ")";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,76 +3,34 @@ package io.swagger.client.model {
|
||||
|
||||
[XmlRootNode(name="User")]
|
||||
public class User {
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="id")]
|
||||
|
||||
[XmlElement(name="id")]
|
||||
public var id: Number = 0;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="username")]
|
||||
|
||||
[XmlElement(name="username")]
|
||||
public var username: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="firstName")]
|
||||
|
||||
[XmlElement(name="firstName")]
|
||||
public var firstName: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="lastName")]
|
||||
|
||||
[XmlElement(name="lastName")]
|
||||
public var lastName: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="email")]
|
||||
|
||||
[XmlElement(name="email")]
|
||||
public var email: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="password")]
|
||||
|
||||
[XmlElement(name="password")]
|
||||
public var password: String = null;
|
||||
|
||||
|
||||
|
||||
[XmlElement(name="phone")]
|
||||
|
||||
[XmlElement(name="phone")]
|
||||
public var phone: String = null;
|
||||
|
||||
/* User Status */
|
||||
|
||||
|
||||
[XmlElement(name="userStatus")]
|
||||
|
||||
public var userStatus: Number = 0;
|
||||
|
||||
|
||||
public function toString(): String {
|
||||
var str: String = "User: ";
|
||||
|
||||
str += " (id: " + id + ")";
|
||||
|
||||
str += " (username: " + username + ")";
|
||||
|
||||
str += " (firstName: " + firstName + ")";
|
||||
|
||||
str += " (lastName: " + lastName + ")";
|
||||
|
||||
str += " (email: " + email + ")";
|
||||
|
||||
str += " (password: " + password + ")";
|
||||
|
||||
str += " (phone: " + phone + ")";
|
||||
|
||||
str += " (userStatus: " + userStatus + ")";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
52
samples/client/petstore/flash/git_push.sh
Normal file
52
samples/client/petstore/flash/git_push.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="YOUR_GIT_USR_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="YOUR_GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
||||
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
||||
17
samples/client/petstore/perl/docs/ApiResponse.md
Normal file
17
samples/client/petstore/perl/docs/ApiResponse.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# WWW::SwaggerClient::Object::ApiResponse
|
||||
|
||||
## Load the model package
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::ApiResponse;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **int** | | [optional]
|
||||
**type** | **string** | | [optional]
|
||||
**message** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package WWW::SwaggerClient::Object::ApiResponse;
|
||||
|
||||
require 5.6.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use JSON qw(decode_json);
|
||||
use Data::Dumper;
|
||||
use Module::Runtime qw(use_module);
|
||||
use Log::Any qw($log);
|
||||
use Date::Parse;
|
||||
use DateTime;
|
||||
|
||||
use base ("Class::Accessor", "Class::Data::Inheritable");
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
#
|
||||
|
||||
__PACKAGE__->mk_classdata('attribute_map' => {});
|
||||
__PACKAGE__->mk_classdata('swagger_types' => {});
|
||||
__PACKAGE__->mk_classdata('method_documentation' => {});
|
||||
__PACKAGE__->mk_classdata('class_documentation' => {});
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, %args) = @_;
|
||||
|
||||
my $self = bless {}, $class;
|
||||
|
||||
foreach my $attribute (keys %{$class->attribute_map}) {
|
||||
my $args_key = $class->attribute_map->{$attribute};
|
||||
$self->$attribute( $args{ $args_key } );
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# return perl hash
|
||||
sub to_hash {
|
||||
return decode_json(JSON->new->convert_blessed->encode( shift ));
|
||||
}
|
||||
|
||||
# used by JSON for serialization
|
||||
sub TO_JSON {
|
||||
my $self = shift;
|
||||
my $_data = {};
|
||||
foreach my $_key (keys %{$self->attribute_map}) {
|
||||
if (defined $self->{$_key}) {
|
||||
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
|
||||
}
|
||||
}
|
||||
return $_data;
|
||||
}
|
||||
|
||||
# from Perl hashref
|
||||
sub from_hash {
|
||||
my ($self, $hash) = @_;
|
||||
|
||||
# loop through attributes and use swagger_types to deserialize the data
|
||||
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
|
||||
my $_json_attribute = $self->attribute_map->{$_key};
|
||||
if ($_type =~ /^array\[/i) { # array
|
||||
my $_subclass = substr($_type, 6, -1);
|
||||
my @_array = ();
|
||||
foreach my $_element (@{$hash->{$_json_attribute}}) {
|
||||
push @_array, $self->_deserialize($_subclass, $_element);
|
||||
}
|
||||
$self->{$_key} = \@_array;
|
||||
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
|
||||
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
|
||||
} else {
|
||||
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
|
||||
}
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
# deserialize non-array data
|
||||
sub _deserialize {
|
||||
my ($self, $type, $data) = @_;
|
||||
$log->debugf("deserializing %s with %s",Dumper($data), $type);
|
||||
|
||||
if ($type eq 'DateTime') {
|
||||
return DateTime->from_epoch(epoch => str2time($data));
|
||||
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
|
||||
return $data;
|
||||
} else { # hash(model)
|
||||
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
|
||||
return $_instance->from_hash($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
__PACKAGE__->class_documentation({description => '',
|
||||
class => 'ApiResponse',
|
||||
required => [], # TODO
|
||||
} );
|
||||
|
||||
__PACKAGE__->method_documentation({
|
||||
'code' => {
|
||||
datatype => 'int',
|
||||
base_name => 'code',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'type' => {
|
||||
datatype => 'string',
|
||||
base_name => 'type',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'message' => {
|
||||
datatype => 'string',
|
||||
base_name => 'message',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
});
|
||||
|
||||
__PACKAGE__->swagger_types( {
|
||||
'code' => 'int',
|
||||
'type' => 'string',
|
||||
'message' => 'string'
|
||||
} );
|
||||
|
||||
__PACKAGE__->attribute_map( {
|
||||
'code' => 'code',
|
||||
'type' => 'type',
|
||||
'message' => 'message'
|
||||
} );
|
||||
|
||||
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||
|
||||
|
||||
1;
|
||||
17
samples/client/petstore/perl/t/ApiResponseTest.t
Normal file
17
samples/client/petstore/perl/t/ApiResponseTest.t
Normal file
@@ -0,0 +1,17 @@
|
||||
# NOTE: This class is auto generated by the Swagger Codegen
|
||||
# Please update the test case below to test the model.
|
||||
|
||||
use Test::More tests => 2;
|
||||
use Test::Exception;
|
||||
|
||||
use lib 'lib';
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
use_ok('WWW::SwaggerClient::Object::ApiResponse');
|
||||
|
||||
my $instance = WWW::SwaggerClient::Object::ApiResponse->new();
|
||||
|
||||
isa_ok($instance, 'WWW::SwaggerClient::Object::ApiResponse');
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **int** | | [optional]
|
||||
**type** | **string** | | [optional]
|
||||
**message** | **string** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiResponse
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace Swagger\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
/**
|
||||
* ApiResponse Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class ApiResponse implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* The original name of the model.
|
||||
* @var string
|
||||
*/
|
||||
static $swaggerModelName = 'ApiResponse';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
'code' => 'int',
|
||||
'type' => 'string',
|
||||
'message' => 'string'
|
||||
);
|
||||
|
||||
static function swaggerTypes() {
|
||||
return self::$swaggerTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
'code' => 'code',
|
||||
'type' => 'type',
|
||||
'message' => 'message'
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
return self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
'code' => 'setCode',
|
||||
'type' => 'setType',
|
||||
'message' => 'setMessage'
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
return self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
'code' => 'getCode',
|
||||
'type' => 'getType',
|
||||
'message' => 'getMessage'
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
/**
|
||||
* $code
|
||||
* @var int
|
||||
*/
|
||||
protected $code;
|
||||
/**
|
||||
* $type
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
/**
|
||||
* $message
|
||||
* @var string
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->code = $data["code"];
|
||||
$this->type = $data["type"];
|
||||
$this->message = $data["message"];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets code
|
||||
* @return int
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets code
|
||||
* @param int $code
|
||||
* @return $this
|
||||
*/
|
||||
public function setCode($code)
|
||||
{
|
||||
|
||||
$this->code = $code;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Gets type
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets type
|
||||
* @param string $type
|
||||
* @return $this
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Gets message
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets message
|
||||
* @param string $message
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessage($message)
|
||||
{
|
||||
|
||||
$this->message = $message;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiResponseTest
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Class
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
/**
|
||||
* Copyright 2016 SmartBear Software
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace Swagger\Client\Model;
|
||||
|
||||
/**
|
||||
* ApiResponseTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class ApiResponseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ApiResponse
|
||||
*/
|
||||
public function testApiResponse() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
samples/client/petstore/python/docs/ApiResponse.md
Normal file
12
samples/client/petstore/python/docs/ApiResponse.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **int** | | [optional]
|
||||
**type** | **str** | | [optional]
|
||||
**message** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from pprint import pformat
|
||||
from six import iteritems
|
||||
|
||||
|
||||
class ApiResponse(object):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
ApiResponse - a model defined in Swagger
|
||||
|
||||
:param dict swaggerTypes: The key is attribute name
|
||||
and the value is attribute type.
|
||||
:param dict attributeMap: The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
self.swagger_types = {
|
||||
'code': 'int',
|
||||
'type': 'str',
|
||||
'message': 'str'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'code': 'code',
|
||||
'type': 'type',
|
||||
'message': 'message'
|
||||
}
|
||||
|
||||
self._code = None
|
||||
self._type = None
|
||||
self._message = None
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
"""
|
||||
Gets the code of this ApiResponse.
|
||||
|
||||
|
||||
:return: The code of this ApiResponse.
|
||||
:rtype: int
|
||||
"""
|
||||
return self._code
|
||||
|
||||
@code.setter
|
||||
def code(self, code):
|
||||
"""
|
||||
Sets the code of this ApiResponse.
|
||||
|
||||
|
||||
:param code: The code of this ApiResponse.
|
||||
:type: int
|
||||
"""
|
||||
self._code = code
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
Gets the type of this ApiResponse.
|
||||
|
||||
|
||||
:return: The type of this ApiResponse.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._type
|
||||
|
||||
@type.setter
|
||||
def type(self, type):
|
||||
"""
|
||||
Sets the type of this ApiResponse.
|
||||
|
||||
|
||||
:param type: The type of this ApiResponse.
|
||||
:type: str
|
||||
"""
|
||||
self._type = type
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
"""
|
||||
Gets the message of this ApiResponse.
|
||||
|
||||
|
||||
:return: The message of this ApiResponse.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._message
|
||||
|
||||
@message.setter
|
||||
def message(self, message):
|
||||
"""
|
||||
Sets the message of this ApiResponse.
|
||||
|
||||
|
||||
:param message: The message of this ApiResponse.
|
||||
:type: str
|
||||
"""
|
||||
self._message = message
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
||||
value
|
||||
))
|
||||
elif hasattr(value, "to_dict"):
|
||||
result[attr] = value.to_dict()
|
||||
elif isinstance(value, dict):
|
||||
result[attr] = dict(map(
|
||||
lambda item: (item[0], item[1].to_dict())
|
||||
if hasattr(item[1], "to_dict") else item,
|
||||
value.items()
|
||||
))
|
||||
else:
|
||||
result[attr] = value
|
||||
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""
|
||||
Returns the string representation of the model
|
||||
"""
|
||||
return pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
For `print` and `pprint`
|
||||
"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
Returns true if both objects are equal
|
||||
"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
return not self == other
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Pet
|
||||
import io.swagger.client.model.InlineResponse200
|
||||
import io.swagger.client.model.ApiResponse
|
||||
import java.io.File
|
||||
import io.swagger.client.ApiInvoker
|
||||
import io.swagger.client.ApiException
|
||||
@@ -26,7 +26,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store (optional)
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
def addPet (body: Pet) = {
|
||||
@@ -40,6 +40,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->addPet")
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -63,46 +64,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => 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 (optional)
|
||||
* @return void
|
||||
*/
|
||||
def addPetUsingByteArray (body: String) = {
|
||||
// create path and map variables
|
||||
val path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json")
|
||||
val contentTypes = List("application/json", "application/xml", "application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = body
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
@@ -123,7 +85,6 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey
|
||||
|
||||
@@ -135,7 +96,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -147,13 +108,14 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => 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 (optional, default to available)
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return List[Pet]
|
||||
*/
|
||||
def findPetsByStatus (status: List[String] /* = available */) : Option[List[Pet]] = {
|
||||
def findPetsByStatus (status: List[String]) : Option[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/findByStatus".replaceAll("\\{format\\}","json")
|
||||
val contentTypes = List("application/json")
|
||||
@@ -164,6 +126,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (status == null) throw new Exception("Missing required parameter 'status' when calling PetApi->findPetsByStatus")
|
||||
|
||||
if(String.valueOf(status) != "null") queryParams += "status" -> status.toString
|
||||
|
||||
@@ -176,7 +139,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -189,10 +152,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param tags Tags to filter by (optional)
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param tags Tags to filter by
|
||||
* @return List[Pet]
|
||||
*/
|
||||
def findPetsByTags (tags: List[String]) : Option[List[Pet]] = {
|
||||
@@ -206,6 +170,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (tags == null) throw new Exception("Missing required parameter 'tags' when calling PetApi->findPetsByTags")
|
||||
|
||||
if(String.valueOf(tags) != "null") queryParams += "tags" -> tags.toString
|
||||
|
||||
@@ -218,7 +183,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -231,10 +196,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Returns a single pet
|
||||
* @param petId ID of pet to return
|
||||
* @return Pet
|
||||
*/
|
||||
def getPetById (petId: Long) : Option[Pet] = {
|
||||
@@ -250,7 +216,6 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -261,7 +226,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -274,96 +239,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => 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
|
||||
*/
|
||||
def getPetByIdInObject (petId: Long) : Option[InlineResponse200] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[InlineResponse200]).asInstanceOf[InlineResponse200])
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => 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 String
|
||||
*/
|
||||
def petPetIdtestingByteArraytrueGet (petId: Long) : Option[String] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String])
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store (optional)
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
def updatePet (body: Pet) = {
|
||||
@@ -377,6 +257,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->updatePet")
|
||||
|
||||
|
||||
|
||||
@@ -388,7 +269,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -400,6 +281,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
@@ -408,7 +290,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
* @param status Updated status of the pet (optional)
|
||||
* @return void
|
||||
*/
|
||||
def updatePetWithForm (petId: String, name: String, status: String) = {
|
||||
def updatePetWithForm (petId: Long, name: String, status: String) = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
@@ -421,7 +303,6 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -437,7 +318,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
else {
|
||||
formParams += "name" -> name.toString()
|
||||
formParams += "status" -> status.toString()
|
||||
formParams += "status" -> status.toString()
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -450,15 +331,16 @@ formParams += "status" -> status.toString()
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server (optional)
|
||||
* @param file file to upload (optional)
|
||||
* @return void
|
||||
* @return ApiResponse
|
||||
*/
|
||||
def uploadFile (petId: Long, additionalMetadata: String, file: File) = {
|
||||
def uploadFile (petId: Long, additionalMetadata: String, file: File) : Option[ApiResponse] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
@@ -471,7 +353,6 @@ formParams += "status" -> status.toString()
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -488,17 +369,19 @@ formParams += "status" -> status.toString()
|
||||
}
|
||||
else {
|
||||
formParams += "additionalMetadata" -> additionalMetadata.toString()
|
||||
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
case _ => None
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[ApiResponse]).asInstanceOf[ApiResponse])
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -51,7 +50,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -63,48 +62,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => 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 (optional, default to placed)
|
||||
* @return List[Order]
|
||||
*/
|
||||
def findOrdersByStatus (status: String /* = placed */) : Option[List[Order]] = {
|
||||
// create path and map variables
|
||||
val path = "/store/findByStatus".replaceAll("\\{format\\}","json")
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
if(String.valueOf(status) != "null") queryParams += "status" -> status.toString
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "array", classOf[Order]).asInstanceOf[List[Order]])
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
@@ -121,7 +79,6 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -132,7 +89,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -145,53 +102,14 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => 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 Any
|
||||
*/
|
||||
def getInventoryInObject () : Option[Any] = {
|
||||
// create path and map variables
|
||||
val path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json")
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[Any]).asInstanceOf[Any])
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw 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
|
||||
* @return Order
|
||||
*/
|
||||
def getOrderById (orderId: String) : Option[Order] = {
|
||||
def getOrderById (orderId: Long) : Option[Order] = {
|
||||
// create path and map variables
|
||||
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
|
||||
|
||||
@@ -204,7 +122,6 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -215,7 +132,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -228,10 +145,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet (optional)
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
*/
|
||||
def placeOrder (body: Order) : Option[Order] = {
|
||||
@@ -245,6 +163,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling StoreApi->placeOrder")
|
||||
|
||||
|
||||
|
||||
@@ -256,7 +175,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -269,4 +188,5 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* @param body Created user object (optional)
|
||||
* @param body Created user object
|
||||
* @return void
|
||||
*/
|
||||
def createUser (body: User) = {
|
||||
@@ -38,6 +38,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUser")
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -61,10 +62,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object (optional)
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
def createUsersWithArrayInput (body: List[User]) = {
|
||||
@@ -78,6 +80,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithArrayInput")
|
||||
|
||||
|
||||
|
||||
@@ -89,7 +92,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -101,10 +104,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object (optional)
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
def createUsersWithListInput (body: List[User]) = {
|
||||
@@ -118,6 +122,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithListInput")
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +134,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -141,6 +146,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -160,7 +166,6 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -171,7 +176,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -183,6 +188,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
@@ -202,7 +208,6 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -213,7 +218,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -226,11 +231,12 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param username The user name for login (optional)
|
||||
* @param password The password for login in clear text (optional)
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return String
|
||||
*/
|
||||
def loginUser (username: String, password: String) : Option[String] = {
|
||||
@@ -244,7 +250,6 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
if(String.valueOf(username) != "null") queryParams += "username" -> username.toString
|
||||
if(String.valueOf(password) != "null") queryParams += "password" -> password.toString
|
||||
|
||||
@@ -257,7 +262,7 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -270,6 +275,7 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
@@ -286,7 +292,6 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
@@ -297,7 +302,7 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -309,11 +314,12 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object (optional)
|
||||
* @param body Updated user object
|
||||
* @return void
|
||||
*/
|
||||
def updateUser (username: String, body: User) = {
|
||||
@@ -329,6 +335,7 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->updateUser")
|
||||
|
||||
|
||||
|
||||
@@ -340,7 +347,7 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
@@ -352,4 +359,5 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class ApiResponse (
|
||||
code: Integer,
|
||||
_type: String,
|
||||
message: String)
|
||||
@@ -1,13 +0,0 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class InlineResponse200 (
|
||||
tags: List[Tag],
|
||||
id: Long,
|
||||
category: Any,
|
||||
/* pet status in the store */
|
||||
status: String,
|
||||
name: String,
|
||||
photoUrls: List[String])
|
||||
@@ -1,7 +0,0 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class Model200Response (
|
||||
name: Integer)
|
||||
@@ -1,7 +0,0 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class ModelReturn (
|
||||
_return: Integer)
|
||||
@@ -1,8 +0,0 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class Name (
|
||||
name: Integer,
|
||||
snakeCase: Integer)
|
||||
@@ -1,7 +0,0 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
|
||||
|
||||
|
||||
case class SpecialModelName (
|
||||
specialPropertyName: Long)
|
||||
@@ -29,7 +29,7 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
api.getOrderById("1000") match {
|
||||
api.getOrderById(1000) match {
|
||||
case Some(order) => {
|
||||
order.id should be(1000)
|
||||
order.petId should be(10)
|
||||
@@ -53,13 +53,13 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
api.getOrderById("1001") match {
|
||||
api.getOrderById(1001) match {
|
||||
case Some(order) => order.id should be(1001)
|
||||
case None => fail("didn't find order created")
|
||||
}
|
||||
|
||||
api.deleteOrder("1001")
|
||||
api.getOrderById("1001") match {
|
||||
api.getOrderById(1001) match {
|
||||
case Some(order) => fail("order should have been deleted")
|
||||
case None =>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user