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

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}}
// verify required params are set
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
throw new RuntimeException("missing required params")
}
{{/allParams}}

View File

@@ -22,7 +22,7 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
val headerParams = new mutable.HashMap[String, String]
{{#allParams}}// verify required params are set
val paramCount = (Set[Any]({{/allParams}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#allParams}}) - null).size
val paramCount = (Set[Any]({{/allParams}}{{#required}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{#allParams}}) - null).size
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/allParams}}
{{#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}};
{{#allParams}}
// verify required params are set
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
throw new ApiException(400, "missing required params");
}{{/allParams}}

View File

@@ -44,7 +44,7 @@ public class {{classname}} extends SwaggerApi {
{{#allParams}}
// verify required params are set
if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) {
if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) {
throw new ApiError(400, "missing required params");
}
{{/allParams}}

View File

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

View File

@@ -3,7 +3,7 @@ organization := ""
name := "-client"
libraryDependencies ++= Seq(
"io.swagger" %% "swagger-async-httpclient" % "0.3.5",
"com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.5",
"joda-time" % "joda-time" % "2.3",
"org.joda" % "joda-convert" % "1.3.1",
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",

View File

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

View File

@@ -1,37 +1,15 @@
package io.swagger.client.api
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 io.swagger.client._
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import com.wordnik.swagger.client._
import scala.concurrent.Future
import collection.mutable
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def updatePet(body: Option[Pet] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
// 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
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
// 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 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,6 +33,55 @@ 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)
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
@@ -63,7 +92,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
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 }
@@ -75,7 +106,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def findPetsByTags(tags: Option[List[String]] = None
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
// 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 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 }
@@ -97,7 +129,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
// create path and map variables
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 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,6 +152,74 @@ 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,
name: Option[String] = None,
@@ -132,7 +233,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
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](// 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,
additionalMetadata: Option[String] = 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 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")
@@ -194,5 +282,4 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}

View File

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

View File

@@ -1,14 +1,12 @@
package io.swagger.client.api
import io.swagger.client.model.User
import io.swagger.client._
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import com.wordnik.swagger.client._
import scala.concurrent.Future
import collection.mutable
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def createUser(body: Option[User] = None
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
// 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 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
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// 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 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
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// 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 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,6 +76,51 @@ 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,
password: Option[String] = None
@@ -85,7 +132,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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")
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] = {
// create path and map variables
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,
body: Option[User] = None
)(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 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")
@@ -165,27 +196,4 @@ 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
import org.joda.time.DateTime
import java.util.UUID
case class Category (
id: Long,
name: String
id: Option[Long],
name: Option[String]
)

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,12 +16,14 @@ part 'auth/api_key_auth.dart';
part 'auth/oauth.dart';
part 'auth/http_basic_auth.dart';
part 'api/user_api.dart';
part 'api/store_api.dart';
part 'api/pet_api.dart';
part 'api/store_api.dart';
part 'api/user_api.dart';
part 'model/user.dart';
part 'model/api_response.dart';
part 'model/category.dart';
part 'model/order.dart';
part 'model/pet.dart';
part 'model/tag.dart';
part 'model/order.dart';
part 'model/user.dart';

View File

@@ -1,7 +1,6 @@
part of api;
class PetApi {
String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient;
@@ -12,59 +11,15 @@ class PetApi {
}
}
/// Update an existing pet
///
///
Future updatePet(Pet body) {
Object postBody = body;
// create path and map variables
String path = "/pet".replaceAll("{format}","json");
// query params
Map<String, String> queryParams = {};
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
}
else {
return ;
}
});
}
/// Add a new pet to the store
///
///
Future addPet(Pet body) {
Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet".replaceAll("{format}","json");
@@ -74,8 +29,6 @@ class PetApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -89,8 +42,7 @@ class PetApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -104,13 +56,64 @@ class PetApi {
}
});
}
/// Deletes a pet
///
///
Future deletePet(int petId, String apiKey) {
Object postBody = null;
// verify required params are set
if( // verify required params are set
if() {
throw new ApiException(400, "missing required params");
}) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
// query params
Map<String, String> queryParams = {};
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
headerParams["api_key"] = apiKey;
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
}
else {
return ;
}
});
}
/// Finds Pets by status
///
/// Multiple status values can be provided with comma seperated strings
/// Multiple status values can be provided with comma separated strings
Future<List<Pet>> findPetsByStatus(List<String> status) {
Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/findByStatus".replaceAll("{format}","json");
@@ -122,8 +125,6 @@ class PetApi {
if("null" != status)
queryParams["status"] = status is List ? status.join(',') : status;
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -137,8 +138,7 @@ class PetApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -152,13 +152,15 @@ class PetApi {
}
});
}
/// Finds Pets by tags
///
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Future<List<Pet>> findPetsByTags(List<String> tags) {
Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/findByTags".replaceAll("{format}","json");
@@ -170,8 +172,6 @@ class PetApi {
if("null" != tags)
queryParams["tags"] = tags is List ? tags.join(',') : tags;
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -185,8 +185,7 @@ class PetApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -200,13 +199,15 @@ class PetApi {
}
});
}
/// Find pet by ID
///
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// Returns a single pet
Future<Pet> getPetById(int petId) {
Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
@@ -216,12 +217,10 @@ class PetApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth", "api_key"];
List<String> authNames = ["api_key"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
@@ -231,8 +230,7 @@ class PetApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -246,13 +244,66 @@ class PetApi {
}
});
}
/// Update an existing pet
///
///
Future updatePet(Pet body) {
Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet".replaceAll("{format}","json");
// query params
Map<String, String> queryParams = {};
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/json","application/xml"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
}
else {
return ;
}
});
}
/// Updates a pet in the store with form data
///
///
Future updatePetWithForm(String petId, String name, String status) {
Future updatePetWithForm(int petId, String name, String status) {
Object postBody = null;
// verify required params are set
if( // verify required params are set
if( // verify required params are set
if() {
throw new ApiException(400, "missing required params");
}) {
throw new ApiException(400, "missing required params");
}) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
@@ -262,8 +313,6 @@ class PetApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["application/x-www-form-urlencoded"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -289,9 +338,8 @@ class PetApi {
else {
if (name != null)
formParams['name'] = apiClient.parameterToString(name);
if (status != null)
if (status != null)
formParams['status'] = apiClient.parameterToString(status);
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
@@ -306,60 +354,21 @@ class PetApi {
}
});
}
/// Deletes a pet
///
///
Future deletePet(int petId, String apiKey) {
Object postBody = null;
// create path and map variables
String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
// query params
Map<String, String> queryParams = {};
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
headerParams["api_key"] = apiKey;
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];
if(contentType.startsWith("multipart/form-data")) {
bool hasFields = false;
MultipartRequest mp = new MultipartRequest(null, null);
if(hasFields)
postBody = mp;
}
else {
}
return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
}
else {
return ;
}
});
}
/// uploads an image
///
///
Future uploadFile(int petId, String additionalMetadata, MultipartFile file) {
Future<ApiResponse> uploadFile(int petId, String additionalMetadata, MultipartFile file) {
Object postBody = null;
// verify required params are set
if( // verify required params are set
if( // verify required params are set
if() {
throw new ApiException(400, "missing required params");
}) {
throw new ApiException(400, "missing required params");
}) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString());
@@ -369,8 +378,6 @@ class PetApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = ["multipart/form-data"];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -398,7 +405,6 @@ class PetApi {
if (additionalMetadata != null)
formParams['additionalMetadata'] = apiClient.parameterToString(additionalMetadata);
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
@@ -406,13 +412,11 @@ class PetApi {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
return ApiClient.deserialize(response.body, ApiResponse);
}
else {
return ;
return null;
}
});
}
}

View File

@@ -1,7 +1,6 @@
part of api;
class StoreApi {
String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient;
@@ -12,7 +11,51 @@ class StoreApi {
}
}
/// Delete purchase order by ID
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future deleteOrder(String orderId) {
Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
// 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, '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 ;
}
});
}
/// Returns pet inventories by status
///
/// Returns a map of status codes to quantities
@@ -28,8 +71,6 @@ class StoreApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -43,8 +84,7 @@ class StoreApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -58,59 +98,15 @@ class StoreApi {
}
});
}
/// 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) {
/// 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());
@@ -120,8 +116,6 @@ class StoreApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -135,8 +129,7 @@ class StoreApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -150,24 +143,24 @@ class StoreApi {
}
});
}
/// Delete purchase order by ID
/// Place an order for a pet
///
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Future deleteOrder(String orderId) {
Object postBody = null;
///
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/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString());
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";
@@ -181,21 +174,18 @@ class StoreApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'DELETE', 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) {
throw new ApiException(response.statusCode, response.body);
}
else if(response.body != null){
return ;
return ApiClient.deserialize(response.body, Order);
}
else {
return ;
return null;
}
});
}
}

View File

@@ -1,7 +1,6 @@
part of api;
class UserApi {
String basePath = "http://petstore.swagger.io/v2";
ApiClient apiClient = ApiClient.defaultApiClient;
@@ -12,13 +11,15 @@ class UserApi {
}
}
/// Create user
///
/// This can only be done by the logged in user.
Future createUser(User body) {
Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user".replaceAll("{format}","json");
@@ -28,8 +29,6 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -43,8 +42,7 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -58,13 +56,15 @@ class UserApi {
}
});
}
/// Creates list of users with given input array
///
///
Future createUsersWithArrayInput(List<User> body) {
Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user/createWithArray".replaceAll("{format}","json");
@@ -74,8 +74,6 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -89,8 +87,7 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -104,13 +101,15 @@ class UserApi {
}
});
}
/// Creates list of users with given input array
///
///
Future createUsersWithListInput(List<User> body) {
Object postBody = body;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user/createWithList".replaceAll("{format}","json");
@@ -120,7 +119,50 @@ class UserApi {
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 ;
}
else {
return ;
}
});
}
/// Delete user
///
/// This can only be done by the logged in user.
Future deleteUser(String username) {
Object postBody = null;
// verify required params are set
if() {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString());
// query params
Map<String, String> queryParams = {};
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
@@ -135,10 +177,9 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'POST', 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) {
throw new ApiException(response.statusCode, response.body);
}
@@ -150,13 +191,63 @@ 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");
@@ -167,11 +258,9 @@ class UserApi {
Map<String, String> formParams = {};
if("null" != username)
queryParams["username"] = username is List ? username.join(',') : username;
if("null" != password)
if("null" != password)
queryParams["password"] = password is List ? password.join(',') : password;
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -185,8 +274,7 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -200,7 +288,6 @@ class UserApi {
}
});
}
/// Logs out current logged in user session
///
///
@@ -216,8 +303,6 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -231,8 +316,7 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -246,59 +330,18 @@ class UserApi {
}
});
}
/// 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;
// 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());
@@ -308,8 +351,6 @@ class UserApi {
Map<String, String> headerParams = {};
Map<String, String> formParams = {};
List<String> contentTypes = [];
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
@@ -323,8 +364,7 @@ class UserApi {
postBody = mp;
}
else {
}
}
return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) {
if(response.statusCode >= 400) {
@@ -338,52 +378,4 @@ class UserApi {
}
});
}
/// Delete user
///
/// This can only be done by the logged in user.
Future deleteUser(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, '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 ;
}
});
}
}

View File

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

View File

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

View File

@@ -15,13 +15,12 @@ class Order {
DateTime shipDate = null;
/* Order Status */
/* Order Status */
String status = null;
//enum statusEnum { placed, approved, delivered, };
bool complete = null;
Order();
@override

View File

@@ -18,10 +18,9 @@ class Pet {
List<Tag> tags = [];
/* pet status in the store */
/* pet status in the store */
String status = null;
//enum statusEnum { available, pending, sold, };
Pet();
@override

View File

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

View File

@@ -24,10 +24,9 @@ class User {
String phone = null;
/* User Status */
/* User Status */
int userStatus = null;
User();
@override

View File

@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
import io.swagger.event.Response;
import io.swagger.common.SwaggerApi;
import io.swagger.client.model.Pet;
import io.swagger.client.model.InlineResponse200;
import flash.filesystem.File;
import mx.rpc.AsyncToken;
@@ -24,47 +25,19 @@ public class PetApi extends SwaggerApi {
super(apiCredentials, eventDispatcher);
}
public static const event_update_pet: String = "update_pet";
public static const event_add_pet: String = "add_pet";
public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array";
public static const event_delete_pet: String = "delete_pet";
public static const event_find_pets_by_status: String = "find_pets_by_status";
public static const event_find_pets_by_tags: String = "find_pets_by_tags";
public static const event_get_pet_by_id: String = "get_pet_by_id";
public static const event_get_pet_by_id_in_object: String = "get_pet_by_id_in_object";
public static const event_pet_pet_idtesting_byte_arraytrue_get: String = "pet_pet_idtesting_byte_arraytrue_get";
public static const event_update_pet: String = "update_pet";
public static const event_update_pet_with_form: String = "update_pet_with_form";
public static const event_delete_pet: String = "delete_pet";
public static const event_upload_file: String = "upload_file";
public static const event_get_pet_by_id_with_byte_array: String = "get_pet_by_id_with_byte_array";
public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array";
/*
* Returns void
*/
public function update_pet (body: Pet): String {
// create path and map variables
var path: String = "/pet".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "update_pet";
token.returnType = null ;
return requestId;
}
/*
* Returns void
*/
@@ -76,9 +49,10 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -94,6 +68,71 @@ public class PetApi extends SwaggerApi {
}
/*
* Returns void
*/
public function add_pet_using_byte_array (body: String): String {
// create path and map variables
var path: String = "/pet?testing_byte_array&#x3D;true".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "add_pet_using_byte_array";
token.returnType = null ;
return requestId;
}
/*
* Returns void
*/
public function delete_pet (petId: Number, apiKey: 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() {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
headerParams["apiKey"] = toPathValue(apiKey);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_pet";
token.returnType = null ;
return requestId;
}
/*
* Returns Array
*/
@@ -105,14 +144,15 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
if("null" != String(status))
queryParams["status"] = toPathValue(status);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
@@ -136,14 +176,15 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
if("null" != String(tags))
queryParams["tags"] = toPathValue(tags);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
@@ -167,9 +208,10 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -185,6 +227,96 @@ public class PetApi extends SwaggerApi {
}
/*
* 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
*/
@@ -196,9 +328,18 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if( // verify required params are set
if( // verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
@@ -214,36 +355,6 @@ public class PetApi extends SwaggerApi {
}
/*
* Returns void
*/
public function delete_pet (petId: Number, apiKey: 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();
headerParams["apiKey"] = toPathValue(apiKey);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_pet";
token.returnType = null ;
return requestId;
}
/*
* Returns void
*/
@@ -255,9 +366,18 @@ public class PetApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if( // verify required params are set
if( // verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
@@ -272,65 +392,5 @@ public class PetApi extends SwaggerApi {
return requestId;
}
/*
* Returns String
*/
public function get_pet_by_id_with_byte_array (petId: Number): String {
// create path and map variables
var path: String = "/pet/{petId}?testing_byte_array=true".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "get_pet_by_id_with_byte_array";
token.returnType = String;
return requestId;
}
/*
* Returns void
*/
public function add_pet_using_byte_array (body: String): String {
// create path and map variables
var path: String = "/pet?testing_byte_array=true".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "add_pet_using_byte_array";
token.returnType = null ;
return requestId;
}
}
}

View File

@@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials;
import io.swagger.event.Response;
import io.swagger.common.SwaggerApi;
import io.swagger.client.model.Order;
import io.swagger.client.model.Object;
import mx.rpc.AsyncToken;
import mx.utils.UIDUtil;
@@ -23,12 +24,76 @@ public class StoreApi extends SwaggerApi {
super(apiCredentials, eventDispatcher);
}
public static const event_get_inventory: String = "get_inventory";
public static const event_place_order: String = "place_order";
public static const event_get_order_by_id: String = "get_order_by_id";
public static const event_delete_order: String = "delete_order";
public static const event_find_orders_by_status: String = "find_orders_by_status";
public static const event_get_inventory: String = "get_inventory";
public static const event_get_inventory_in_object: String = "get_inventory_in_object";
public static const event_get_order_by_id: String = "get_order_by_id";
public static const event_place_order: String = "place_order";
/*
* Returns void
*/
public function delete_order (orderId: String): String {
// create path and map variables
var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_order";
token.returnType = null ;
return requestId;
}
/*
* Returns Array
*/
public function find_orders_by_status (status: String): String {
// create path and map variables
var path: String = "/store/findByStatus".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
if("null" != String(status))
queryParams["status"] = toPathValue(status);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "find_orders_by_status";
token.returnType = Array;
return requestId;
}
/*
* Returns Dictionary
*/
@@ -43,9 +108,6 @@ public class StoreApi extends SwaggerApi {
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
@@ -59,11 +121,11 @@ public class StoreApi extends SwaggerApi {
}
/*
* Returns Order
* Returns Object
*/
public function place_order (body: Order): String {
public function get_inventory_in_object (): String {
// create path and map variables
var path: String = "/store/order".replace(/{format}/g,"xml");
var path: String = "/store/inventory?response&#x3D;arbitrary_object".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
@@ -72,17 +134,14 @@ public class StoreApi extends SwaggerApi {
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "place_order";
token.completionEventType = "get_inventory_in_object";
token.returnType = Order;
token.returnType = Object;
return requestId;
}
@@ -98,9 +157,10 @@ public class StoreApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -117,34 +177,33 @@ public class StoreApi extends SwaggerApi {
}
/*
* Returns void
* Returns Order
*/
public function delete_order (orderId: String): String {
public function place_order (body: Order): String {
// create path and map variables
var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
var path: String = "/store/order".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_order";
token.completionEventType = "place_order";
token.returnType = null ;
token.returnType = Order;
return requestId;
}
}
}

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_users_with_array_input: String = "create_users_with_array_input";
public static const event_create_users_with_list_input: String = "create_users_with_list_input";
public static const event_delete_user: String = "delete_user";
public static const event_get_user_by_name: String = "get_user_by_name";
public static const event_login_user: String = "login_user";
public static const event_logout_user: String = "logout_user";
public static const event_get_user_by_name: String = "get_user_by_name";
public static const event_update_user: String = "update_user";
public static const event_delete_user: String = "delete_user";
/*
@@ -44,9 +44,10 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -73,9 +74,10 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -102,9 +104,10 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
@@ -120,6 +123,66 @@ public class UserApi extends SwaggerApi {
}
/*
* Returns void
*/
public function delete_user (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, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_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();
// 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
*/
@@ -131,16 +194,21 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if( // verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
if("null" != String(username))
queryParams["username"] = toPathValue(username);
if("null" != String(password))
if("null" != String(password))
queryParams["password"] = toPathValue(password);
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
@@ -167,9 +235,6 @@ public class UserApi extends SwaggerApi {
var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams);
var requestId: String = getUniqueId();
@@ -182,35 +247,6 @@ public class UserApi extends SwaggerApi {
}
/*
* 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
*/
@@ -222,9 +258,14 @@ public class UserApi extends SwaggerApi {
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if( // verify required params are set
if() {
throw new ApiError(400, "missing required params");
}
) {
throw new ApiError(400, "missing required params");
}
@@ -239,36 +280,5 @@ public class UserApi extends SwaggerApi {
return requestId;
}
/*
* Returns void
*/
public function delete_user (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, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "delete_user";
token.returnType = null ;
return requestId;
}
}
}

View File

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

View File

@@ -14,5 +14,4 @@ import io.swagger.common.ListWrapper;
}
}

View File

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

View File

@@ -14,5 +14,4 @@ import io.swagger.common.ListWrapper;
}
}

View File

@@ -5,68 +5,34 @@ import io.swagger.client.model.Tag;
[XmlRootNode(name="Pet")]
public class Pet {
[XmlElement(name="id")]
[XmlElement(name="id")]
public var id: Number = 0;
[XmlElement(name="category")]
[XmlElement(name="category")]
public var category: Category = NaN;
[XmlElement(name="name")]
[XmlElement(name="name")]
public var name: String = null;
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
private var _photoUrls_obj_class: Array = null;
[XmlElementWrapper(name="photoUrls")]
[XmlElements(name="photoUrls", type="Array")]
public var photoUrls: Array = new Array();
// This declaration below of _tags_obj_class is to force flash compiler to include this class
public var photoUrls: Array = new Array();
// This declaration below of _tags_obj_class is to force flash compiler to include this class
private var _tags_obj_class: Array = null;
[XmlElementWrapper(name="tags")]
[XmlElements(name="tags", type="Array")]
public var tags: Array = new Array();
public var tags: Array = new Array();
/* pet status in the store */
[XmlElement(name="status")]
public var status: String = null;
public function toString(): String {
var str: String = "Pet: ";
str += " (id: " + id + ")";
str += " (category: " + category + ")";
str += " (name: " + name + ")";
str += " (photoUrls: " + photoUrls + ")";
str += " (tags: " + tags + ")";
str += " (status: " + status + ")";
return str;
}

View File

@@ -16,5 +16,4 @@ import io.swagger.client.model.Tag;
}
}

View File

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

View File

@@ -14,5 +14,4 @@ import io.swagger.common.ListWrapper;
}
}

View File

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

View File

@@ -14,5 +14,4 @@ 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 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 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 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
@@ -164,6 +184,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = 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
@@ -206,6 +231,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = 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
@@ -250,6 +280,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = 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 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 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 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 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 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 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 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
@@ -204,6 +214,11 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
val headerParams = 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 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 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 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 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 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 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 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(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 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")
}