replace requiredParam with reuqired

This commit is contained in:
wing328
2016-04-15 22:54:46 +08:00
parent 35144b2c1d
commit 87e542c69c
47 changed files with 1537 additions and 1442 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead. # 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" 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 java $JAVA_OPTS -jar $executable $ags

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -34,7 +34,7 @@ class {{classname}} {
{{#allParams}} {{#allParams}}
// verify required params are set // 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") throw new RuntimeException("missing required params")
} }
{{/allParams}} {{/allParams}}
@@ -53,4 +53,4 @@ class {{classname}} {
} }
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@@ -22,7 +22,7 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
{{#allParams}}// verify required params are set {{#allParams}}// verify required params are set
val paramCount = (Set[Any]({{/allParams}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#allParams}}) - null).size val paramCount = (Set[Any]({{/allParams}}{{#required}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{#allParams}}) - null).size
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/allParams}} if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/allParams}}
{{#queryParams}}{{^required}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/required}}{{#required}} {{#queryParams}}{{^required}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/required}}{{#required}}

View File

@@ -20,7 +20,7 @@ class {{classname}} {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}} {{#allParams}}
// verify required params are set // 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"); throw new ApiException(400, "missing required params");
}{{/allParams}} }{{/allParams}}

View File

@@ -44,7 +44,7 @@ public class {{classname}} extends SwaggerApi {
{{#allParams}} {{#allParams}}
// verify required params are set // 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"); throw new ApiError(400, "missing required params");
} }
{{/allParams}} {{/allParams}}

View File

@@ -45,11 +45,9 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
{{#allParams}} {{#allParams}}
// verify required params are set {{#required}}
(List({{/allParams}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#allParams}}).filter(_ != null)).size match { if ({{paramName}} != null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
case {{requiredParamCount}} => // all required values set {{/required}}
case _ => throw new Exception("missing required params")
}
{{/allParams}} {{/allParams}}
{{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString {{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString

View File

@@ -3,7 +3,7 @@ organization := ""
name := "-client" name := "-client"
libraryDependencies ++= Seq( 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", "joda-time" % "joda-time" % "2.3",
"org.joda" % "joda-convert" % "1.3.1", "org.joda" % "joda-convert" % "1.3.1",
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided", "ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",

View File

@@ -2,7 +2,7 @@ package io.swagger.client
import io.swagger.client.api._ import io.swagger.client.api._
import io.swagger.client._ import com.wordnik.swagger.client._
import java.io.Closeable import java.io.Closeable
@@ -14,14 +14,14 @@ class SwaggerClient(config: SwaggerConfig) extends Closeable {
protected def transportClient: TransportClient = new RestClient(config) protected def transportClient: TransportClient = new RestClient(config)
val user = new UserApi(client, config)
val pet = new PetApi(client, config) val pet = new PetApi(client, config)
val store = new StoreApi(client, config) val store = new StoreApi(client, config)
val user = new UserApi(client, config)
def close() { def close() {
client.close() client.close()
} }
} }

View File

@@ -1,37 +1,15 @@
package io.swagger.client.api package io.swagger.client.api
import io.swagger.client.model.Pet import io.swagger.client.model.Pet
import io.swagger.client.model.Inline_response_200
import io.swagger.client.model.Binary
import java.io.File import java.io.File
import io.swagger.client._ import com.wordnik.swagger.client._
import scala.concurrent.{ Future, Await } import scala.concurrent.Future
import scala.concurrent.duration._
import collection.mutable import collection.mutable
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) { 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] = {
// 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("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def addPet(body: Option[Pet] = None def addPet(body: Option[Pet] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = { )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
// create path and map variables // create path and map variables
@@ -41,7 +19,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
@@ -53,7 +33,56 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
def addPetUsingByteArray(body: Option[Binary] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Binary]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/pet?testing_byte_array=true"))
// query params
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def deletePet(petId: Long,
apiKey: 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]
// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")
headerParams += "api_key" -> apiKey.toString
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def findPetsByStatus(status: Option[List[String]] = Some(available) def findPetsByStatus(status: Option[List[String]] = Some(available)
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = { )(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
// create path and map variables // create path and map variables
@@ -63,7 +92,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
if(status != null) status.foreach { v => queryParams += "status" -> v.toString } if(status != null) status.foreach { v => queryParams += "status" -> v.toString }
@@ -75,7 +106,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
def findPetsByTags(tags: Option[List[String]] = None def findPetsByTags(tags: Option[List[String]] = None
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = { )(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
// create path and map variables // create path and map variables
@@ -85,7 +115,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
if(tags != null) tags.foreach { v => queryParams += "tags" -> v.toString } if(tags != null) tags.foreach { v => queryParams += "tags" -> v.toString }
@@ -97,7 +129,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = { def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
// create path and map variables // create path and map variables
val path = (addFmt("/pet/{petId}") val path = (addFmt("/pet/{petId}")
@@ -107,7 +138,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
@@ -119,7 +152,75 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
def getPetByIdInObject(petId: Long)(implicit reader: ClientResponseReader[Inline_response_200]): Future[Inline_response_200] = {
// create path and map variables
val path = (addFmt("/pet/{petId}?response=inline_arbitrary_object")
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
// query params
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def petPetIdtestingByteArraytrueGet(petId: Long)(implicit reader: ClientResponseReader[Binary]): Future[Binary] = {
// create path and map variables
val path = (addFmt("/pet/{petId}?testing_byte_array=true")
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
// query params
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def updatePet(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]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def updatePetWithForm(petId: String, def updatePetWithForm(petId: String,
name: Option[String] = None, name: Option[String] = None,
status: Option[String] = None status: Option[String] = None
@@ -132,7 +233,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")
@@ -144,31 +251,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
def deletePet(petId: Long,
apiKey: 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]
headerParams += "api_key" -> apiKey.toString
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def uploadFile(petId: Long, def uploadFile(petId: Long,
additionalMetadata: Option[String] = None, additionalMetadata: Option[String] = None,
file: Option[File] = None file: Option[File] = None
@@ -181,7 +263,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")
@@ -193,6 +281,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
} }
} }
} }

View File

@@ -1,14 +1,59 @@
package io.swagger.client.api package io.swagger.client.api
import io.swagger.client.model.Order import io.swagger.client.model.Order
import io.swagger.client._ import io.swagger.client.model.Any
import scala.concurrent.{ Future, Await } import com.wordnik.swagger.client._
import scala.concurrent.duration._ import scala.concurrent.Future
import collection.mutable import collection.mutable
class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) { class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
// 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]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def findOrdersByStatus(status: Option[String] = Some(placed)
)(implicit reader: ClientResponseReader[List[Order]]): Future[List[Order]] = {
// create path and map variables
val path = (addFmt("/store/findByStatus"))
// query params
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
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 getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = { def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
// create path and map variables // create path and map variables
val path = (addFmt("/store/inventory")) val path = (addFmt("/store/inventory"))
@@ -29,33 +74,9 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
} }
} }
def getInventoryInObject()(implicit reader: ClientResponseReader[Any]): Future[Any] = {
def placeOrder(body: Option[Order] = None
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
// create path and map variables // create path and map variables
val path = (addFmt("/store/order")) val path = (addFmt("/store/inventory?response=arbitrary_object"))
// 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 // query params
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
@@ -73,8 +94,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
} }
} }
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
// create path and map variables // create path and map variables
val path = (addFmt("/store/order/{orderId}") val path = (addFmt("/store/order/{orderId}")
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString)) replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
@@ -83,18 +103,42 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "") 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]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
resFuture flatMap { resp => resFuture flatMap { resp =>
process(reader.read(resp)) process(reader.read(resp))
} }
} }
} }

View File

@@ -1,14 +1,12 @@
package io.swagger.client.api package io.swagger.client.api
import io.swagger.client.model.User import io.swagger.client.model.User
import io.swagger.client._ import com.wordnik.swagger.client._
import scala.concurrent.{ Future, Await } import scala.concurrent.Future
import scala.concurrent.duration._
import collection.mutable import collection.mutable
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) { class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def createUser(body: Option[User] = None def createUser(body: Option[User] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = { )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
// create path and map variables // create path and map variables
@@ -18,7 +16,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
@@ -30,7 +30,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
} }
} }
def createUsersWithArrayInput(body: Option[List[User]] = None def createUsersWithArrayInput(body: Option[List[User]] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = { )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// create path and map variables // create path and map variables
@@ -40,7 +39,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
@@ -52,7 +53,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
} }
} }
def createUsersWithListInput(body: Option[List[User]] = None def createUsersWithListInput(body: Option[List[User]] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = { )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// create path and map variables // create path and map variables
@@ -62,7 +62,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
@@ -74,7 +76,52 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
} }
} }
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): 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]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("DELETE", 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]
// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
def loginUser(username: Option[String] = None, def loginUser(username: Option[String] = None,
password: Option[String] = None password: Option[String] = None
)(implicit reader: ClientResponseReader[String]): Future[String] = { )(implicit reader: ClientResponseReader[String]): Future[String] = {
@@ -85,7 +132,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")
if(username != null) username.foreach { v => queryParams += "username" -> v.toString }if(password != null) password.foreach { v => queryParams += "password" -> v.toString } if(username != null) username.foreach { v => queryParams += "username" -> v.toString }if(password != null) password.foreach { v => queryParams += "password" -> v.toString }
@@ -97,7 +148,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
} }
} }
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = { def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
// create path and map variables // create path and map variables
val path = (addFmt("/user/logout")) val path = (addFmt("/user/logout"))
@@ -118,29 +168,6 @@ 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 updateUser(username: String, def updateUser(username: String,
body: Option[User] = None body: Option[User] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = { )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
@@ -152,7 +179,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
val queryParams = new mutable.HashMap[String, String] val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String] val headerParams = new mutable.HashMap[String, String]
// verify required params are set
val paramCount = (Set[Any](// verify required params are set
val paramCount = (Set[Any]() - null).size
if (paramCount != ) sys.error("missing required params")) - null).size
if (paramCount != ) sys.error("missing required params")
@@ -164,28 +195,5 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
} }
} }
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): 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("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
}
}
} }

View File

@@ -1,10 +1,10 @@
package io.swagger.client.model package io.swagger.client.model
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.UUID
case class Category ( case class Category (
id: Long, id: Option[Long],
name: String name: Option[String]
) )

View File

@@ -1,14 +1,14 @@
package io.swagger.client.model package io.swagger.client.model
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.UUID
case class Order ( case class Order (
id: Long, id: Option[Long],
petId: Long, petId: Option[Long],
quantity: Integer, quantity: Option[Integer],
shipDate: DateTime, shipDate: Option[DateTime],
status: String, // Order Status status: Option[String], // Order Status
complete: Boolean complete: Option[Boolean]
) )

View File

@@ -1,14 +1,14 @@
package io.swagger.client.model package io.swagger.client.model
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.UUID
case class Pet ( case class Pet (
id: Long, id: Option[Long],
category: Category, category: Option[Category],
name: String, name: String,
photoUrls: List[String], photoUrls: List[String],
tags: List[Tag], tags: Option[List[Tag]],
status: String // pet status in the store status: Option[String] // pet status in the store
) )

View File

@@ -1,10 +1,10 @@
package io.swagger.client.model package io.swagger.client.model
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.UUID
case class Tag ( case class Tag (
id: Long, id: Option[Long],
name: String name: Option[String]
) )

View File

@@ -1,16 +1,16 @@
package io.swagger.client.model package io.swagger.client.model
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.UUID
case class User ( case class User (
id: Long, id: Option[Long],
username: String, username: Option[String],
firstName: String, firstName: Option[String],
lastName: String, lastName: Option[String],
email: String, email: Option[String],
password: String, password: Option[String],
phone: String, phone: Option[String],
userStatus: Integer // User Status userStatus: Option[Integer] // User Status
) )

View File

@@ -16,12 +16,14 @@ part 'auth/api_key_auth.dart';
part 'auth/oauth.dart'; part 'auth/oauth.dart';
part 'auth/http_basic_auth.dart'; part 'auth/http_basic_auth.dart';
part 'api/user_api.dart';
part 'api/store_api.dart';
part 'api/pet_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/category.dart';
part 'model/order.dart';
part 'model/pet.dart'; part 'model/pet.dart';
part 'model/tag.dart'; part 'model/tag.dart';
part 'model/order.dart'; part 'model/user.dart';

View File

@@ -1,7 +1,6 @@
part of api; part of api;
class PetApi { class PetApi {
String basePath = "http://petstore.swagger.io/v2"; String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient; 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 /// Add a new pet to the store
/// ///
/// ///
Future addPet(Pet body) { Future addPet(Pet body) {
Object postBody = body; Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/pet".replaceAll("{format}","json"); String path = "/pet".replaceAll("{format}","json");
@@ -73,9 +28,7 @@ class PetApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = ["application/json","application/xml"]; List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -89,8 +42,7 @@ class PetApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { 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 /// 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) { Future<List<Pet>> findPetsByStatus(List<String> status) {
Object postBody = null; Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/pet/findByStatus".replaceAll("{format}","json"); String path = "/pet/findByStatus".replaceAll("{format}","json");
@@ -122,8 +125,6 @@ class PetApi {
if("null" != status) if("null" != status)
queryParams["status"] = status is List ? status.join(',') : status; queryParams["status"] = status is List ? status.join(',') : status;
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -137,8 +138,7 @@ class PetApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { if(response.statusCode >= 400) {
@@ -152,13 +152,15 @@ class PetApi {
} }
}); });
} }
/// Finds Pets by tags /// 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) { Future<List<Pet>> findPetsByTags(List<String> tags) {
Object postBody = null; Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/pet/findByTags".replaceAll("{format}","json"); String path = "/pet/findByTags".replaceAll("{format}","json");
@@ -170,8 +172,6 @@ class PetApi {
if("null" != tags) if("null" != tags)
queryParams["tags"] = tags is List ? tags.join(',') : tags; queryParams["tags"] = tags is List ? tags.join(',') : tags;
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -185,8 +185,7 @@ class PetApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { if(response.statusCode >= 400) {
@@ -200,13 +199,15 @@ class PetApi {
} }
}); });
} }
/// Find pet by ID /// Find pet by ID
/// ///
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions /// Returns a single pet
Future<Pet> getPetById(int petId) { Future<Pet> getPetById(int petId) {
Object postBody = null; Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
@@ -215,13 +216,11 @@ class PetApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; 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")) { if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false; bool hasFields = false;
@@ -231,8 +230,7 @@ class PetApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { 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 /// 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; 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 // create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
@@ -261,9 +312,7 @@ class PetApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = ["application/x-www-form-urlencoded"]; List<String> contentTypes = ["application/x-www-form-urlencoded"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -289,9 +338,8 @@ class PetApi {
else { else {
if (name != null) if (name != null)
formParams['name'] = apiClient.parameterToString(name); formParams['name'] = apiClient.parameterToString(name);
if (status != null) if (status != null)
formParams['status'] = apiClient.parameterToString(status); formParams['status'] = apiClient.parameterToString(status);
} }
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { 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 /// uploads an image
/// ///
/// ///
Future uploadFile(int petId, String additionalMetadata, MultipartFile file) { Future<ApiResponse> uploadFile(int petId, String additionalMetadata, MultipartFile file) {
Object postBody = null; 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 // create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); 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> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = ["multipart/form-data"]; List<String> contentTypes = ["multipart/form-data"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -397,8 +404,7 @@ class PetApi {
else { else {
if (additionalMetadata != null) if (additionalMetadata != null)
formParams['additionalMetadata'] = apiClient.parameterToString(additionalMetadata); formParams['additionalMetadata'] = apiClient.parameterToString(additionalMetadata);
} }
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { 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); throw new ApiException(response.statusCode, response.body);
} }
else if(response.body != null){ else if(response.body != null){
return ; return ApiClient.deserialize(response.body, ApiResponse);
} }
else { else {
return ; return null;
} }
}); });
} }
} }

View File

@@ -1,7 +1,6 @@
part of api; part of api;
class StoreApi { class StoreApi {
String basePath = "http://petstore.swagger.io/v2"; String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient; 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 &lt;= 5 or &gt; 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 /// Delete purchase order by ID
/// ///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors /// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future deleteOrder(String orderId) { Future deleteOrder(String orderId) {
Object postBody = null; Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); 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> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -181,8 +42,7 @@ class StoreApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { 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 &lt;&#x3D; 5 or &gt; 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;
}
});
}
}

View File

@@ -1,7 +1,6 @@
part of api; part of api;
class UserApi { class UserApi {
String basePath = "http://petstore.swagger.io/v2"; String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient; ApiClient apiClient = ApiClient.defaultApiClient;
@@ -12,13 +11,15 @@ class UserApi {
} }
} }
/// Create user /// Create user
/// ///
/// This can only be done by the logged in user. /// This can only be done by the logged in user.
Future createUser(User body) { Future createUser(User body) {
Object postBody = body; Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/user".replaceAll("{format}","json"); String path = "/user".replaceAll("{format}","json");
@@ -27,9 +28,7 @@ class UserApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -43,8 +42,7 @@ class UserApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { if(response.statusCode >= 400) {
@@ -58,13 +56,15 @@ class UserApi {
} }
}); });
} }
/// Creates list of users with given input array /// Creates list of users with given input array
/// ///
/// ///
Future createUsersWithArrayInput(List<User> body) { Future createUsersWithArrayInput(List<User> body) {
Object postBody = body; Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/user/createWithArray".replaceAll("{format}","json"); String path = "/user/createWithArray".replaceAll("{format}","json");
@@ -73,9 +73,7 @@ class UserApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -89,8 +87,7 @@ class UserApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { if(response.statusCode >= 400) {
@@ -104,13 +101,15 @@ class UserApi {
} }
}); });
} }
/// Creates list of users with given input array /// Creates list of users with given input array
/// ///
/// ///
Future createUsersWithListInput(List<User> body) { Future createUsersWithListInput(List<User> body) {
Object postBody = body; Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/user/createWithList".replaceAll("{format}","json"); String path = "/user/createWithList".replaceAll("{format}","json");
@@ -119,9 +118,7 @@ class UserApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -135,8 +132,7 @@ class UserApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { 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 /// Delete user
/// ///
/// This can only be done by the logged in user. /// This can only be done by the logged in user.
Future deleteUser(String username) { Future deleteUser(String username) {
Object postBody = null; Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables // create path and map variables
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
@@ -353,9 +163,7 @@ class UserApi {
Map<String, String> queryParams = {}; Map<String, String> queryParams = {};
Map<String, String> headerParams = {}; Map<String, String> headerParams = {};
Map<String, String> formParams = {}; Map<String, String> formParams = {};
List<String> contentTypes = []; List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -369,8 +177,7 @@ class UserApi {
postBody = mp; postBody = mp;
} }
else { else {
}
}
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) { 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 ;
}
});
}
}

View File

@@ -61,32 +61,18 @@ class ApiClient {
bool isMap = json is Map; bool isMap = json is Map;
switch(clazz) { switch(clazz) {
case ApiResponse:
return isMap ? dson.map(json, new ApiResponse()) : dson.decode(json, new ApiResponse());
case User:
return isMap ? dson.map(json, new User()) : dson.decode(json, new User());
case Category: case Category:
return isMap ? dson.map(json, new Category()) : dson.decode(json, new 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: case Order:
return isMap ? dson.map(json, new Order()) : dson.decode(json, new 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: default:
throw new ApiException(500, 'Could not find a suitable class for deserialization'); throw new ApiException(500, 'Could not find a suitable class for deserialization');
} }

View File

@@ -6,10 +6,9 @@ class Category {
int id = null; int id = null;
String name = null; String name = null;
Category(); Category();
@override @override

View File

@@ -6,22 +6,21 @@ class Order {
int id = null; int id = null;
int petId = null; int petId = null;
int quantity = null; int quantity = null;
DateTime shipDate = null; DateTime shipDate = null;
/* Order Status */ /* Order Status */
String status = null; String status = null;
//enum statusEnum { placed, approved, delivered, }; //enum statusEnum { placed, approved, delivered, };
bool complete = null; bool complete = null;
Order(); Order();
@override @override

View File

@@ -6,22 +6,21 @@ class Pet {
int id = null; int id = null;
Category category = null; Category category = null;
String name = null; String name = null;
List<String> photoUrls = []; List<String> photoUrls = [];
List<Tag> tags = []; List<Tag> tags = [];
/* pet status in the store */ /* pet status in the store */
String status = null; String status = null;
//enum statusEnum { available, pending, sold, }; //enum statusEnum { available, pending, sold, };
Pet(); Pet();
@override @override

View File

@@ -6,10 +6,9 @@ class Tag {
int id = null; int id = null;
String name = null; String name = null;
Tag(); Tag();
@override @override

View File

@@ -6,28 +6,27 @@ class User {
int id = null; int id = null;
String username = null; String username = null;
String firstName = null; String firstName = null;
String lastName = null; String lastName = null;
String email = null; String email = null;
String password = null; String password = null;
String phone = null; String phone = null;
/* User Status */ /* User Status */
int userStatus = null; int userStatus = null;
User(); User();
@override @override

View File

@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
import io.swagger.event.Response; import io.swagger.event.Response;
import io.swagger.common.SwaggerApi; import io.swagger.common.SwaggerApi;
import io.swagger.client.model.Pet; import io.swagger.client.model.Pet;
import io.swagger.client.model.InlineResponse200;
import flash.filesystem.File; import flash.filesystem.File;
import mx.rpc.AsyncToken; import mx.rpc.AsyncToken;
@@ -24,47 +25,19 @@ public class PetApi extends SwaggerApi {
super(apiCredentials, eventDispatcher); 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: 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_status: String = "find_pets_by_status";
public static const event_find_pets_by_tags: String = "find_pets_by_tags"; 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: 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_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_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 * Returns void
*/ */
@@ -76,12 +49,13 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -93,127 +67,37 @@ public class PetApi extends SwaggerApi {
return requestId; 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 * 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 // 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&#x3D;true".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
token.requestId = requestId; token.requestId = requestId;
token.completionEventType = "update_pet_with_form"; token.completionEventType = "add_pet_using_byte_array";
token.returnType = null ; token.returnType = null ;
return requestId; return requestId;
} }
/* /*
* Returns void * Returns void
*/ */
@@ -225,12 +109,17 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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); headerParams["apiKey"] = toPathValue(apiKey);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
@@ -243,7 +132,229 @@ public class PetApi extends SwaggerApi {
return requestId; 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&#x3D;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&#x3D;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 * Returns void
*/ */
@@ -255,12 +366,21 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -272,65 +392,5 @@ public class PetApi extends SwaggerApi {
return requestId; 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;
}
} }
} }

View File

@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
import io.swagger.event.Response; import io.swagger.event.Response;
import io.swagger.common.SwaggerApi; import io.swagger.common.SwaggerApi;
import io.swagger.client.model.Order; import io.swagger.client.model.Order;
import io.swagger.client.model.Object;
import mx.rpc.AsyncToken; import mx.rpc.AsyncToken;
import mx.utils.UIDUtil; import mx.utils.UIDUtil;
@@ -23,12 +24,76 @@ public class StoreApi extends SwaggerApi {
super(apiCredentials, eventDispatcher); 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_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 * Returns Dictionary
*/ */
@@ -40,12 +105,9 @@ public class StoreApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -57,36 +119,33 @@ public class StoreApi extends SwaggerApi {
return requestId; 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 // create path and map variables
var path: String = "/store/order".replace(/{format}/g,"xml"); var path: String = "/store/inventory?response&#x3D;arbitrary_object".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
token.requestId = requestId; token.requestId = requestId;
token.completionEventType = "place_order"; token.completionEventType = "get_inventory_in_object";
token.returnType = Order; token.returnType = Object;
return requestId; return requestId;
} }
/* /*
* Returns Order * Returns Order
*/ */
@@ -98,12 +157,13 @@ public class StoreApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -115,36 +175,35 @@ public class StoreApi extends SwaggerApi {
return requestId; 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 // 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 // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
token.requestId = requestId; token.requestId = requestId;
token.completionEventType = "delete_order"; token.completionEventType = "place_order";
token.returnType = null ; token.returnType = Order;
return requestId; return requestId;
} }
} }
} }

View File

@@ -26,11 +26,11 @@ public class UserApi extends SwaggerApi {
public static const event_create_user: String = "create_user"; 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_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_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_login_user: String = "login_user";
public static const event_logout_user: String = "logout_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_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 queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -61,7 +62,7 @@ public class UserApi extends SwaggerApi {
return requestId; return requestId;
} }
/* /*
* Returns void * Returns void
*/ */
@@ -73,12 +74,13 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -90,7 +92,7 @@ public class UserApi extends SwaggerApi {
return requestId; return requestId;
} }
/* /*
* Returns void * Returns void
*/ */
@@ -102,12 +104,13 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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 token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -119,127 +122,7 @@ public class UserApi extends SwaggerApi {
return requestId; 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 * Returns void
*/ */
@@ -251,12 +134,13 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
var headerParams: 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, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId(); var requestId: String = getUniqueId();
@@ -268,7 +152,133 @@ public class UserApi extends SwaggerApi {
return requestId; 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;
}
}
} }

View File

@@ -3,27 +3,15 @@ package io.swagger.client.model {
[XmlRootNode(name="Category")] [XmlRootNode(name="Category")]
public class Category { public class Category {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0; public var id: Number = 0;
[XmlElement(name="name")]
[XmlElement(name="name")]
public var name: String = null; public var name: String = null;
public function toString(): String { public function toString(): String {
var str: String = "Category: "; var str: String = "Category: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (name: " + name + ")"; str += " (name: " + name + ")";
return str; return str;
} }

View File

@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
} }
} }
} }

View File

@@ -3,60 +3,28 @@ package io.swagger.client.model {
[XmlRootNode(name="Order")] [XmlRootNode(name="Order")]
public class Order { public class Order {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0; public var id: Number = 0;
[XmlElement(name="petId")]
[XmlElement(name="petId")]
public var petId: Number = 0; public var petId: Number = 0;
[XmlElement(name="quantity")]
[XmlElement(name="quantity")]
public var quantity: Number = 0; public var quantity: Number = 0;
[XmlElement(name="shipDate")]
[XmlElement(name="shipDate")]
public var shipDate: Date = null; public var shipDate: Date = null;
/* Order Status */ /* Order Status */
[XmlElement(name="status")] [XmlElement(name="status")]
public var status: String = null; public var status: String = null;
[XmlElement(name="complete")]
[XmlElement(name="complete")]
public var complete: Boolean = false; public var complete: Boolean = false;
public function toString(): String { public function toString(): String {
var str: String = "Order: "; var str: String = "Order: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (petId: " + petId + ")"; str += " (petId: " + petId + ")";
str += " (quantity: " + quantity + ")"; str += " (quantity: " + quantity + ")";
str += " (shipDate: " + shipDate + ")"; str += " (shipDate: " + shipDate + ")";
str += " (status: " + status + ")"; str += " (status: " + status + ")";
str += " (complete: " + complete + ")"; str += " (complete: " + complete + ")";
return str; return str;
} }

View File

@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
} }
} }
} }

View File

@@ -5,68 +5,34 @@ import io.swagger.client.model.Tag;
[XmlRootNode(name="Pet")] [XmlRootNode(name="Pet")]
public class Pet { public class Pet {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0; public var id: Number = 0;
[XmlElement(name="category")]
[XmlElement(name="category")]
public var category: Category = NaN; public var category: Category = NaN;
[XmlElement(name="name")]
[XmlElement(name="name")]
public var name: String = null; 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; private var _photoUrls_obj_class: Array = null;
[XmlElementWrapper(name="photoUrls")] [XmlElementWrapper(name="photoUrls")]
[XmlElements(name="photoUrls", type="Array")] [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; private var _tags_obj_class: Array = null;
[XmlElementWrapper(name="tags")] [XmlElementWrapper(name="tags")]
[XmlElements(name="tags", type="Array")] [XmlElements(name="tags", type="Array")]
public var tags: Array = new Array();
public var tags: Array = new Array();
/* pet status in the store */ /* pet status in the store */
[XmlElement(name="status")] [XmlElement(name="status")]
public var status: String = null; public var status: String = null;
public function toString(): String { public function toString(): String {
var str: String = "Pet: "; var str: String = "Pet: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (category: " + category + ")"; str += " (category: " + category + ")";
str += " (name: " + name + ")"; str += " (name: " + name + ")";
str += " (photoUrls: " + photoUrls + ")"; str += " (photoUrls: " + photoUrls + ")";
str += " (tags: " + tags + ")"; str += " (tags: " + tags + ")";
str += " (status: " + status + ")"; str += " (status: " + status + ")";
return str; return str;
} }

View File

@@ -15,6 +15,5 @@ import io.swagger.client.model.Tag;
} }
} }
} }

View File

@@ -3,27 +3,15 @@ package io.swagger.client.model {
[XmlRootNode(name="Tag")] [XmlRootNode(name="Tag")]
public class Tag { public class Tag {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0; public var id: Number = 0;
[XmlElement(name="name")]
[XmlElement(name="name")]
public var name: String = null; public var name: String = null;
public function toString(): String { public function toString(): String {
var str: String = "Tag: "; var str: String = "Tag: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (name: " + name + ")"; str += " (name: " + name + ")";
return str; return str;
} }

View File

@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
} }
} }
} }

View File

@@ -3,76 +3,34 @@ package io.swagger.client.model {
[XmlRootNode(name="User")] [XmlRootNode(name="User")]
public class User { public class User {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0; public var id: Number = 0;
[XmlElement(name="username")]
[XmlElement(name="username")]
public var username: String = null; public var username: String = null;
[XmlElement(name="firstName")]
[XmlElement(name="firstName")]
public var firstName: String = null; public var firstName: String = null;
[XmlElement(name="lastName")]
[XmlElement(name="lastName")]
public var lastName: String = null; public var lastName: String = null;
[XmlElement(name="email")]
[XmlElement(name="email")]
public var email: String = null; public var email: String = null;
[XmlElement(name="password")]
[XmlElement(name="password")]
public var password: String = null; public var password: String = null;
[XmlElement(name="phone")]
[XmlElement(name="phone")]
public var phone: String = null; public var phone: String = null;
/* User Status */ /* User Status */
[XmlElement(name="userStatus")] [XmlElement(name="userStatus")]
public var userStatus: Number = 0; public var userStatus: Number = 0;
public function toString(): String { public function toString(): String {
var str: String = "User: "; var str: String = "User: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (username: " + username + ")"; str += " (username: " + username + ")";
str += " (firstName: " + firstName + ")"; str += " (firstName: " + firstName + ")";
str += " (lastName: " + lastName + ")"; str += " (lastName: " + lastName + ")";
str += " (email: " + email + ")"; str += " (email: " + email + ")";
str += " (password: " + password + ")"; str += " (password: " + password + ")";
str += " (phone: " + phone + ")"; str += " (phone: " + phone + ")";
str += " (userStatus: " + userStatus + ")"; str += " (userStatus: " + userStatus + ")";
return str; return str;
} }

View File

@@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper;
} }
} }
} }

View File

@@ -40,6 +40,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -80,6 +85,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -123,6 +133,16 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List( // verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
headerParams += "api_key" -> apiKey headerParams += "api_key" -> apiKey
@@ -164,6 +184,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
if(String.valueOf(status) != "null") queryParams += "status" -> status.toString if(String.valueOf(status) != "null") queryParams += "status" -> status.toString
@@ -206,6 +231,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
if(String.valueOf(tags) != "null") queryParams += "tags" -> tags.toString if(String.valueOf(tags) != "null") queryParams += "tags" -> tags.toString
@@ -250,6 +280,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -293,6 +328,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -336,6 +376,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -377,6 +422,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -421,6 +471,21 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List( // verify required params are set
(List( // verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -471,6 +536,21 @@ formParams += "status" -> status.toString()
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List( // verify required params are set
(List( // verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}

View File

@@ -40,6 +40,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -80,6 +85,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
if(String.valueOf(status) != "null") queryParams += "status" -> status.toString if(String.valueOf(status) != "null") queryParams += "status" -> status.toString
@@ -204,6 +214,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -245,6 +260,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}

View File

@@ -38,6 +38,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -78,6 +83,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -118,6 +128,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -160,6 +175,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -202,6 +222,11 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
@@ -244,6 +269,16 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List( // verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
if(String.valueOf(username) != "null") queryParams += "username" -> username.toString if(String.valueOf(username) != "null") queryParams += "username" -> username.toString
if(String.valueOf(password) != "null") queryParams += "password" -> password.toString if(String.valueOf(password) != "null") queryParams += "password" -> password.toString
@@ -329,6 +364,16 @@ if(String.valueOf(password) != "null") queryParams += "password" -> password.toS
val headerParams = new HashMap[String, String] val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String] val formParams = new HashMap[String, String]
// verify required params are set
(List( // verify required params are set
(List().filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}
).filter(_ != null)).size match {
case => // all required values set
case _ => throw new Exception("missing required params")
}