diff --git a/bin/all-wordnik.sh b/bin/all-wordnik.sh deleted file mode 100755 index 95f71f10ab0..00000000000 --- a/bin/all-wordnik.sh +++ /dev/null @@ -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 diff --git a/bin/android-java-wordnik-api.sh b/bin/android-java-wordnik-api.sh deleted file mode 100755 index 551afcfa09b..00000000000 --- a/bin/android-java-wordnik-api.sh +++ /dev/null @@ -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 diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 387d005132b..292af62977f 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l 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 diff --git a/bin/java-wordnik-api.sh b/bin/java-wordnik-api.sh deleted file mode 100755 index 38b5afd37f4..00000000000 --- a/bin/java-wordnik-api.sh +++ /dev/null @@ -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 diff --git a/bin/objc-wordnik-api.sh b/bin/objc-wordnik-api.sh deleted file mode 100755 index 54807ca0512..00000000000 --- a/bin/objc-wordnik-api.sh +++ /dev/null @@ -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 diff --git a/bin/scala-wordnik-api.sh b/bin/scala-wordnik-api.sh deleted file mode 100755 index 88692e34082..00000000000 --- a/bin/scala-wordnik-api.sh +++ /dev/null @@ -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 diff --git a/modules/swagger-codegen/src/main/resources/Groovy/api.mustache b/modules/swagger-codegen/src/main/resources/Groovy/api.mustache index 2607e89289b..0d60fa2a96f 100644 --- a/modules/swagger-codegen/src/main/resources/Groovy/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Groovy/api.mustache @@ -34,7 +34,7 @@ class {{classname}} { {{#allParams}} // verify required params are set - if({{/allParams}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#allParams}}) { + if({{/allParams}}{{#required}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/required}}{{#allParams}}) { throw new RuntimeException("missing required params") } {{/allParams}} @@ -53,4 +53,4 @@ class {{classname}} { } {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/asyncscala/api.mustache b/modules/swagger-codegen/src/main/resources/asyncscala/api.mustache index 10aa6c7b757..aa5888cbe3f 100644 --- a/modules/swagger-codegen/src/main/resources/asyncscala/api.mustache +++ b/modules/swagger-codegen/src/main/resources/asyncscala/api.mustache @@ -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}} diff --git a/modules/swagger-codegen/src/main/resources/dart/api.mustache b/modules/swagger-codegen/src/main/resources/dart/api.mustache index 6d8619639e5..d8ee98569c1 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api.mustache @@ -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}} diff --git a/modules/swagger-codegen/src/main/resources/flash/api.mustache b/modules/swagger-codegen/src/main/resources/flash/api.mustache index ecb68d827e3..b1312a339d4 100644 --- a/modules/swagger-codegen/src/main/resources/flash/api.mustache +++ b/modules/swagger-codegen/src/main/resources/flash/api.mustache @@ -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}} diff --git a/modules/swagger-codegen/src/main/resources/scala/api.mustache b/modules/swagger-codegen/src/main/resources/scala/api.mustache index 2643c2e9632..ae1e3d36b57 100644 --- a/modules/swagger-codegen/src/main/resources/scala/api.mustache +++ b/modules/swagger-codegen/src/main/resources/scala/api.mustache @@ -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 diff --git a/samples/client/petstore/async-scala/build.sbt b/samples/client/petstore/async-scala/build.sbt index b02498c74e8..e612d5937ea 100644 --- a/samples/client/petstore/async-scala/build.sbt +++ b/samples/client/petstore/async-scala/build.sbt @@ -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", diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/SwaggerClient.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/SwaggerClient.scala index 9d0c05187a9..f9f2e5d6216 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/SwaggerClient.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/SwaggerClient.scala @@ -2,7 +2,7 @@ package io.swagger.client import io.swagger.client.api._ -import io.swagger.client._ +import com.wordnik.swagger.client._ import java.io.Closeable @@ -14,14 +14,14 @@ class SwaggerClient(config: SwaggerConfig) extends Closeable { protected def transportClient: TransportClient = new RestClient(config) - val user = new UserApi(client, config) - val pet = new PetApi(client, config) val store = new StoreApi(client, config) + val user = new UserApi(client, config) + def close() { client.close() } -} \ No newline at end of file +} diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala index 84b6ba4c7ea..3b2c3909453 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -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,7 +33,56 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c } } - + def addPetUsingByteArray(body: Option[Binary] = None + )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Binary]): Future[Unit] = { + // create path and map variables + val path = (addFmt("/pet?testing_byte_array=true")) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body)) + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + + def deletePet(petId: Long, + apiKey: Option[String] = None + )(implicit reader: ClientResponseReader[Unit]): Future[Unit] = { + // create path and map variables + val path = (addFmt("/pet/{petId}") + replaceAll ("\\{" + "petId" + "\\}",petId.toString)) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any](// verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params")) - null).size + if (paramCount != ) sys.error("missing required params") + + + + headerParams += "api_key" -> apiKey.toString + + val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + def findPetsByStatus(status: Option[List[String]] = Some(available) )(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = { // create path and map variables @@ -63,7 +92,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c val queryParams = new mutable.HashMap[String, String] val 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,7 +152,75 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c } } - + def getPetByIdInObject(petId: Long)(implicit reader: ClientResponseReader[Inline_response_200]): Future[Inline_response_200] = { + // create path and map variables + val path = (addFmt("/pet/{petId}?response=inline_arbitrary_object") + replaceAll ("\\{" + "petId" + "\\}",petId.toString)) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + + def petPetIdtestingByteArraytrueGet(petId: Long)(implicit reader: ClientResponseReader[Binary]): Future[Binary] = { + // create path and map variables + val path = (addFmt("/pet/{petId}?testing_byte_array=true") + replaceAll ("\\{" + "petId" + "\\}",petId.toString)) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + + def updatePet(body: Option[Pet] = None + )(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = { + // create path and map variables + val path = (addFmt("/pet")) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body)) + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + def updatePetWithForm(petId: String, name: Option[String] = None, status: Option[String] = None @@ -132,7 +233,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c val queryParams = new mutable.HashMap[String, String] val 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") @@ -193,6 +281,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c } } - } diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/StoreApi.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/StoreApi.scala index c7a18efbf14..e823ebd4e32 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/StoreApi.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/StoreApi.scala @@ -1,14 +1,59 @@ 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 val path = (addFmt("/store/inventory")) @@ -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("DELETE", path, queryParams.toMap, headerParams.toMap, "") + val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + + def placeOrder(body: Option[Order] = None + )(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = { + // create path and map variables + val path = (addFmt("/store/order")) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body)) resFuture flatMap { resp => process(reader.read(resp)) } } - } diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/UserApi.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/UserApi.scala index 766e4d22312..33ad25499c6 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/UserApi.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/UserApi.scala @@ -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,7 +76,52 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient( } } - + def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = { + // create path and map variables + val path = (addFmt("/user/{username}") + replaceAll ("\\{" + "username" + "\\}",username.toString)) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + + def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = { + // create path and map variables + val path = (addFmt("/user/{username}") + replaceAll ("\\{" + "username" + "\\}",username.toString)) + + // query params + val queryParams = new mutable.HashMap[String, String] + val headerParams = new mutable.HashMap[String, String] + + // verify required params are set + val paramCount = (Set[Any]() - null).size + if (paramCount != ) sys.error("missing required params") + + + + + + val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "") + resFuture flatMap { resp => + process(reader.read(resp)) + } + } + def loginUser(username: Option[String] = None, password: Option[String] = None )(implicit reader: ClientResponseReader[String]): Future[String] = { @@ -85,7 +132,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient( val queryParams = new mutable.HashMap[String, String] val 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") @@ -164,28 +195,5 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient( } } - - def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = { - // create path and map variables - val path = (addFmt("/user/{username}") - replaceAll ("\\{" + "username" + "\\}",username.toString)) - - // query params - val queryParams = new mutable.HashMap[String, String] - val headerParams = new mutable.HashMap[String, String] - - - - - - - - val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "") - resFuture flatMap { resp => - process(reader.read(resp)) - } - } - - } diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Category.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Category.scala index 1b410e7c59e..afd533df15e 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Category.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Category.scala @@ -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] ) diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Order.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Order.scala index f7a10a44965..42f4859e2e3 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Order.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Order.scala @@ -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] ) diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Pet.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Pet.scala index 7e76c72914b..f296c7f7146 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Pet.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Pet.scala @@ -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 ) diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Tag.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Tag.scala index 9dfe60d36f8..3d7772c5659 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Tag.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/Tag.scala @@ -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] ) diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/User.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/User.scala index 598adae451a..e016b7a88dd 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/User.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/model/User.scala @@ -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 ) diff --git a/samples/client/petstore/dart/lib/api.dart b/samples/client/petstore/dart/lib/api.dart index 3dba4e66eef..c296270af64 100644 --- a/samples/client/petstore/dart/lib/api.dart +++ b/samples/client/petstore/dart/lib/api.dart @@ -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'; + diff --git a/samples/client/petstore/dart/lib/api/pet_api.dart b/samples/client/petstore/dart/lib/api/pet_api.dart index b800b535d84..b6c807e72f0 100644 --- a/samples/client/petstore/dart/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/lib/api/pet_api.dart @@ -1,7 +1,6 @@ part of api; - class PetApi { String basePath = "http://petstore.swagger.io/v2"; ApiClient apiClient = ApiClient.defaultApiClient; @@ -12,59 +11,15 @@ class PetApi { } } - - /// Update an existing pet - /// - /// - Future updatePet(Pet body) { - Object postBody = body; - - - // create path and map variables - String path = "/pet".replaceAll("{format}","json"); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = ["application/json","application/xml"]; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = ["petstore_auth"]; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ; - } - else { - return ; - } - }); - } - /// Add a new pet to the store /// /// Future addPet(Pet body) { Object postBody = body; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/pet".replaceAll("{format}","json"); @@ -73,9 +28,7 @@ class PetApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List 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 queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + headerParams["api_key"] = apiKey; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List 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> findPetsByStatus(List 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 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> findPetsByTags(List 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 contentTypes = []; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -185,8 +185,7 @@ class PetApi { postBody = mp; } else { - - } + } return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { if(response.statusCode >= 400) { @@ -200,13 +199,15 @@ class PetApi { } }); } - /// Find pet by ID /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet Future getPetById(int petId) { Object postBody = null; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); @@ -215,13 +216,11 @@ class PetApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List contentTypes = []; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = ["petstore_auth", "api_key"]; + List 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 queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json","application/xml"]; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ; + } + else { + return ; + } + }); + } /// Updates a pet in the store with form data /// /// - Future updatePetWithForm(String petId, String name, String status) { + Future updatePetWithForm(int petId, String name, String status) { Object postBody = null; - + // verify required params are set + if( // verify required params are set + if( // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); @@ -261,9 +312,7 @@ class PetApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List 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 queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - headerParams["api_key"] = apiKey; - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List 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 uploadFile(int petId, String additionalMetadata, MultipartFile file) { Object postBody = null; - + // verify required params are set + if( // verify required params are set + if( // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); @@ -368,9 +377,7 @@ class PetApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List contentTypes = ["multipart/form-data"]; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -397,8 +404,7 @@ class PetApi { else { if (additionalMetadata != null) formParams['additionalMetadata'] = apiClient.parameterToString(additionalMetadata); - - + } return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { @@ -406,13 +412,11 @@ class PetApi { throw new ApiException(response.statusCode, response.body); } else if(response.body != null){ - return ; + return ApiClient.deserialize(response.body, ApiResponse); } else { - return ; + return null; } }); } - } - diff --git a/samples/client/petstore/dart/lib/api/store_api.dart b/samples/client/petstore/dart/lib/api/store_api.dart index fb346e317ee..25e3ccfcf6e 100644 --- a/samples/client/petstore/dart/lib/api/store_api.dart +++ b/samples/client/petstore/dart/lib/api/store_api.dart @@ -1,7 +1,6 @@ part of api; - class StoreApi { String basePath = "http://petstore.swagger.io/v2"; ApiClient apiClient = ApiClient.defaultApiClient; @@ -12,151 +11,15 @@ class StoreApi { } } - - /// Returns pet inventories by status - /// - /// Returns a map of status codes to quantities - Future> getInventory() { - Object postBody = null; - - - // create path and map variables - String path = "/store/inventory".replaceAll("{format}","json"); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = ["api_key"]; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ApiClient.deserialize(response.body, Map); - } - else { - return null; - } - }); - } - - /// Place an order for a pet - /// - /// - Future placeOrder(Order body) { - Object postBody = body; - - - // create path and map variables - String path = "/store/order".replaceAll("{format}","json"); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ApiClient.deserialize(response.body, Order); - } - else { - return null; - } - }); - } - - /// Find purchase order by ID - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - Future getOrderById(String orderId) { - Object postBody = null; - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ApiClient.deserialize(response.body, Order); - } - else { - return null; - } - }); - } - /// Delete purchase order by ID /// /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors Future deleteOrder(String orderId) { Object postBody = null; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); @@ -165,9 +28,7 @@ class StoreApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List contentTypes = []; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -181,8 +42,7 @@ class StoreApi { postBody = mp; } else { - - } + } return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { if(response.statusCode >= 400) { @@ -196,6 +56,136 @@ class StoreApi { } }); } - -} + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() { + Object postBody = null; + + // create path and map variables + String path = "/store/inventory".replaceAll("{format}","json"); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ApiClient.deserialize(response.body, Map); + } + else { + return null; + } + }); + } + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future getOrderById(int orderId) { + Object postBody = null; + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } + + // create path and map variables + String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ApiClient.deserialize(response.body, Order); + } + else { + return null; + } + }); + } + /// Place an order for a pet + /// + /// + Future placeOrder(Order body) { + Object postBody = body; + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } + + // create path and map variables + String path = "/store/order".replaceAll("{format}","json"); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List 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; + } + }); + } +} diff --git a/samples/client/petstore/dart/lib/api/user_api.dart b/samples/client/petstore/dart/lib/api/user_api.dart index b8e7bc0f149..d774ea1f931 100644 --- a/samples/client/petstore/dart/lib/api/user_api.dart +++ b/samples/client/petstore/dart/lib/api/user_api.dart @@ -1,7 +1,6 @@ part of api; - class UserApi { String basePath = "http://petstore.swagger.io/v2"; ApiClient apiClient = ApiClient.defaultApiClient; @@ -12,13 +11,15 @@ class UserApi { } } - /// Create user /// /// This can only be done by the logged in user. Future createUser(User body) { Object postBody = body; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/user".replaceAll("{format}","json"); @@ -27,9 +28,7 @@ class UserApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List 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 body) { Object postBody = body; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/user/createWithArray".replaceAll("{format}","json"); @@ -73,9 +73,7 @@ class UserApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List 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 body) { Object postBody = body; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/user/createWithList".replaceAll("{format}","json"); @@ -119,9 +118,7 @@ class UserApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List contentTypes = []; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -135,8 +132,7 @@ class UserApi { postBody = mp; } else { - - } + } return apiClient.invokeAPI(basePath, path, 'POST', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { if(response.statusCode >= 400) { @@ -150,201 +146,15 @@ class UserApi { } }); } - - /// Logs user into the system - /// - /// - Future loginUser(String username, String password) { - Object postBody = null; - - - // create path and map variables - String path = "/user/login".replaceAll("{format}","json"); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - if("null" != username) - queryParams["username"] = username is List ? username.join(',') : username; - if("null" != password) - queryParams["password"] = password is List ? password.join(',') : password; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ApiClient.deserialize(response.body, String); - } - else { - return null; - } - }); - } - - /// Logs out current logged in user session - /// - /// - Future logoutUser() { - Object postBody = null; - - - // create path and map variables - String path = "/user/logout".replaceAll("{format}","json"); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ; - } - else { - return ; - } - }); - } - - /// Get user by user name - /// - /// - Future 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 queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ApiClient.deserialize(response.body, User); - } - else { - return null; - } - }); - } - - /// Updated user - /// - /// This can only be done by the logged in user. - Future updateUser(String username, User body) { - Object postBody = body; - - - // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); - - // query params - Map queryParams = {}; - Map headerParams = {}; - Map formParams = {}; - - - - List contentTypes = []; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = []; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - - if(hasFields) - postBody = mp; - } - else { - - } - - return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } - else if(response.body != null){ - return ; - } - else { - return ; - } - }); - } - /// Delete user /// /// This can only be done by the logged in user. Future deleteUser(String username) { Object postBody = null; - + // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + } // create path and map variables String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); @@ -353,9 +163,7 @@ class UserApi { Map queryParams = {}; Map headerParams = {}; Map formParams = {}; - - - + List contentTypes = []; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -369,8 +177,7 @@ class UserApi { postBody = mp; } else { - - } + } return apiClient.invokeAPI(basePath, path, 'DELETE', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { if(response.statusCode >= 400) { @@ -384,6 +191,191 @@ class UserApi { } }); } - -} + /// Get user by user name + /// + /// + Future 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 queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List 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 loginUser(String username, String password) { + Object postBody = null; + // verify required params are set + if( // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + } + + // create path and map variables + String path = "/user/login".replaceAll("{format}","json"); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + if("null" != username) + queryParams["username"] = username is List ? username.join(',') : username; +if("null" != password) + queryParams["password"] = password is List ? password.join(',') : password; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ApiClient.deserialize(response.body, String); + } + else { + return null; + } + }); + } + /// Logs out current logged in user session + /// + /// + Future logoutUser() { + Object postBody = null; + + + // create path and map variables + String path = "/user/logout".replaceAll("{format}","json"); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'GET', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ; + } + else { + return ; + } + }); + } + /// Updated user + /// + /// This can only be done by the logged in user. + Future updateUser(String username, User body) { + Object postBody = body; + // verify required params are set + if( // verify required params are set + if() { + throw new ApiException(400, "missing required params"); + }) { + throw new ApiException(400, "missing required params"); + } + + // create path and map variables + String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + + // query params + Map queryParams = {}; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + + if(hasFields) + postBody = mp; + } + else { + } + + return apiClient.invokeAPI(basePath, path, 'PUT', queryParams, postBody, headerParams, formParams, contentType, authNames).then((response) { + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } + else if(response.body != null){ + return ; + } + else { + return ; + } + }); + } +} diff --git a/samples/client/petstore/dart/lib/api_client.dart b/samples/client/petstore/dart/lib/api_client.dart index 82cecd7db49..7cd93d13e61 100644 --- a/samples/client/petstore/dart/lib/api_client.dart +++ b/samples/client/petstore/dart/lib/api_client.dart @@ -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'); } diff --git a/samples/client/petstore/dart/lib/model/category.dart b/samples/client/petstore/dart/lib/model/category.dart index d036a2b186a..8b4c9b47f8b 100644 --- a/samples/client/petstore/dart/lib/model/category.dart +++ b/samples/client/petstore/dart/lib/model/category.dart @@ -6,10 +6,9 @@ class Category { int id = null; - + String name = null; - Category(); @override diff --git a/samples/client/petstore/dart/lib/model/order.dart b/samples/client/petstore/dart/lib/model/order.dart index 487f5fad644..a3c37e839d6 100644 --- a/samples/client/petstore/dart/lib/model/order.dart +++ b/samples/client/petstore/dart/lib/model/order.dart @@ -6,22 +6,21 @@ class Order { int id = null; - + int petId = null; - + int quantity = null; - + DateTime shipDate = null; - /* Order Status */ +/* Order Status */ String status = null; //enum statusEnum { placed, approved, delivered, }; - + bool complete = null; - Order(); @override diff --git a/samples/client/petstore/dart/lib/model/pet.dart b/samples/client/petstore/dart/lib/model/pet.dart index 133cc2eb4ad..649e99527dd 100644 --- a/samples/client/petstore/dart/lib/model/pet.dart +++ b/samples/client/petstore/dart/lib/model/pet.dart @@ -6,22 +6,21 @@ class Pet { int id = null; - + Category category = null; - + String name = null; - + List photoUrls = []; - + List tags = []; - /* pet status in the store */ +/* pet status in the store */ String status = null; //enum statusEnum { available, pending, sold, }; - Pet(); @override diff --git a/samples/client/petstore/dart/lib/model/tag.dart b/samples/client/petstore/dart/lib/model/tag.dart index 36cbb19a796..68214cd49f5 100644 --- a/samples/client/petstore/dart/lib/model/tag.dart +++ b/samples/client/petstore/dart/lib/model/tag.dart @@ -6,10 +6,9 @@ class Tag { int id = null; - + String name = null; - Tag(); @override diff --git a/samples/client/petstore/dart/lib/model/user.dart b/samples/client/petstore/dart/lib/model/user.dart index 4e09c455941..7cd314f7b25 100644 --- a/samples/client/petstore/dart/lib/model/user.dart +++ b/samples/client/petstore/dart/lib/model/user.dart @@ -6,28 +6,27 @@ class User { int id = null; - + String username = null; - + String firstName = null; - + String lastName = null; - + String email = null; - + String password = null; - + String phone = null; - /* User Status */ +/* User Status */ int userStatus = null; - User(); @override diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as b/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as index b35cd5efdc9..c2de0eac9d5 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as @@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials; import io.swagger.event.Response; import io.swagger.common.SwaggerApi; import io.swagger.client.model.Pet; +import io.swagger.client.model.InlineResponse200; import flash.filesystem.File; import mx.rpc.AsyncToken; @@ -24,47 +25,19 @@ public class PetApi extends SwaggerApi { super(apiCredentials, eventDispatcher); } - public static const event_update_pet: String = "update_pet"; public static const event_add_pet: String = "add_pet"; + public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array"; + public static const event_delete_pet: String = "delete_pet"; public static const event_find_pets_by_status: String = "find_pets_by_status"; public static const event_find_pets_by_tags: String = "find_pets_by_tags"; public static const event_get_pet_by_id: String = "get_pet_by_id"; + public static const event_get_pet_by_id_in_object: String = "get_pet_by_id_in_object"; + public static const event_pet_pet_idtesting_byte_arraytrue_get: String = "pet_pet_idtesting_byte_arraytrue_get"; + public static const event_update_pet: String = "update_pet"; public static const event_update_pet_with_form: String = "update_pet_with_form"; - public static const event_delete_pet: String = "delete_pet"; public static const event_upload_file: String = "upload_file"; - public static const event_get_pet_by_id_with_byte_array: String = "get_pet_by_id_with_byte_array"; - public static const event_add_pet_using_byte_array: String = "add_pet_using_byte_array"; - /* - * Returns void - */ - public function update_pet (body: Pet): String { - // create path and map variables - var path: String = "/pet".replace(/{format}/g,"xml"); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "update_pet"; - - token.returnType = null ; - return requestId; - - } - /* * Returns void */ @@ -76,12 +49,13 @@ public class PetApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); @@ -93,127 +67,37 @@ public class PetApi extends SwaggerApi { return requestId; } - - /* - * Returns Array - */ - public function find_pets_by_status (status: Array): String { - // create path and map variables - var path: String = "/pet/findByStatus".replace(/{format}/g,"xml"); - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - if("null" != String(status)) - queryParams["status"] = toPathValue(status); - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "find_pets_by_status"; - - token.returnType = Array; - return requestId; - - } - - /* - * Returns Array - */ - public function find_pets_by_tags (tags: Array): String { - // create path and map variables - var path: String = "/pet/findByTags".replace(/{format}/g,"xml"); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - if("null" != String(tags)) - queryParams["tags"] = toPathValue(tags); - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "find_pets_by_tags"; - - token.returnType = Array; - return requestId; - - } - - /* - * Returns Pet - */ - public function get_pet_by_id (petId: Number): String { - // create path and map variables - var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "get_pet_by_id"; - - token.returnType = Pet; - return requestId; - - } - /* * Returns void */ - public function update_pet_with_form (petId: String, name: String, status: String): String { + public function add_pet_using_byte_array (body: String): String { // create path and map variables - var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); + var path: String = "/pet?testing_byte_array=true".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams); + var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; - token.completionEventType = "update_pet_with_form"; + token.completionEventType = "add_pet_using_byte_array"; token.returnType = null ; return requestId; } - + /* * Returns void */ @@ -225,12 +109,17 @@ public class PetApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if( // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } - headerParams["apiKey"] = toPathValue(apiKey); - var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); @@ -243,7 +132,229 @@ public class PetApi extends SwaggerApi { return requestId; } - + + /* + * Returns Array + */ + public function find_pets_by_status (status: Array): String { + // create path and map variables + var path: String = "/pet/findByStatus".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + if("null" != String(status)) + queryParams["status"] = toPathValue(status); + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "find_pets_by_status"; + + token.returnType = Array; + return requestId; + + } + + /* + * Returns Array + */ + public function find_pets_by_tags (tags: Array): String { + // create path and map variables + var path: String = "/pet/findByTags".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + if("null" != String(tags)) + queryParams["tags"] = toPathValue(tags); + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "find_pets_by_tags"; + + token.returnType = Array; + return requestId; + + } + + /* + * Returns Pet + */ + public function get_pet_by_id (petId: Number): String { + // create path and map variables + var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "get_pet_by_id"; + + token.returnType = Pet; + return requestId; + + } + + /* + * Returns InlineResponse200 + */ + public function get_pet_by_id_in_object (petId: Number): String { + // create path and map variables + var path: String = "/pet/{petId}?response=inline_arbitrary_object".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "get_pet_by_id_in_object"; + + token.returnType = InlineResponse200; + return requestId; + + } + + /* + * Returns String + */ + public function pet_pet_idtesting_byte_arraytrue_get (petId: Number): String { + // create path and map variables + var path: String = "/pet/{petId}?testing_byte_array=true".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "pet_pet_idtesting_byte_arraytrue_get"; + + token.returnType = String; + return requestId; + + } + + /* + * Returns void + */ + public function update_pet (body: Pet): String { + // create path and map variables + var path: String = "/pet".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "update_pet"; + + token.returnType = null ; + return requestId; + + } + + /* + * Returns void + */ + public function update_pet_with_form (petId: String, name: String, status: String): String { + // create path and map variables + var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if( // verify required params are set + if( // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "update_pet_with_form"; + + token.returnType = null ; + return requestId; + + } + /* * Returns void */ @@ -255,12 +366,21 @@ public class PetApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if( // verify required params are set + if( // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams); var requestId: String = getUniqueId(); @@ -272,65 +392,5 @@ public class PetApi extends SwaggerApi { return requestId; } - - /* - * Returns String - */ - public function get_pet_by_id_with_byte_array (petId: Number): String { - // create path and map variables - var path: String = "/pet/{petId}?testing_byte_array=true".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "get_pet_by_id_with_byte_array"; - - token.returnType = String; - return requestId; - - } - - /* - * Returns void - */ - public function add_pet_using_byte_array (body: String): String { - // create path and map variables - var path: String = "/pet?testing_byte_array=true".replace(/{format}/g,"xml"); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "add_pet_using_byte_array"; - - token.returnType = null ; - return requestId; - - } - } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/api/StoreApi.as b/samples/client/petstore/flash/flash/src/io/swagger/client/api/StoreApi.as index 061878ad257..5cb3d02bc0c 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/api/StoreApi.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/api/StoreApi.as @@ -7,6 +7,7 @@ import io.swagger.common.ApiUserCredentials; import io.swagger.event.Response; import io.swagger.common.SwaggerApi; import io.swagger.client.model.Order; +import io.swagger.client.model.Object; import mx.rpc.AsyncToken; import mx.utils.UIDUtil; @@ -23,12 +24,76 @@ public class StoreApi extends SwaggerApi { super(apiCredentials, eventDispatcher); } - public static const event_get_inventory: String = "get_inventory"; - public static const event_place_order: String = "place_order"; - public static const event_get_order_by_id: String = "get_order_by_id"; public static const event_delete_order: String = "delete_order"; + public static const event_find_orders_by_status: String = "find_orders_by_status"; + public static const event_get_inventory: String = "get_inventory"; + public static const event_get_inventory_in_object: String = "get_inventory_in_object"; + public static const event_get_order_by_id: String = "get_order_by_id"; + public static const event_place_order: String = "place_order"; + /* + * Returns void + */ + public function delete_order (orderId: String): String { + // create path and map variables + var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "delete_order"; + + token.returnType = null ; + return requestId; + + } + + /* + * Returns Array + */ + public function find_orders_by_status (status: String): String { + // create path and map variables + var path: String = "/store/findByStatus".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + if("null" != String(status)) + queryParams["status"] = toPathValue(status); + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "find_orders_by_status"; + + token.returnType = Array; + return requestId; + + } + /* * Returns Dictionary */ @@ -40,12 +105,9 @@ public class StoreApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); @@ -57,36 +119,33 @@ public class StoreApi extends SwaggerApi { return requestId; } - + /* - * Returns Order + * Returns Object */ - public function place_order (body: Order): String { + public function get_inventory_in_object (): String { // create path and map variables - var path: String = "/store/order".replace(/{format}/g,"xml"); + var path: String = "/store/inventory?response=arbitrary_object".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; - token.completionEventType = "place_order"; + token.completionEventType = "get_inventory_in_object"; - token.returnType = Order; + token.returnType = Object; return requestId; } - + /* * Returns Order */ @@ -98,12 +157,13 @@ public class StoreApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); var requestId: String = getUniqueId(); @@ -115,36 +175,35 @@ public class StoreApi extends SwaggerApi { return requestId; } - + /* - * Returns void + * Returns Order */ - public function delete_order (orderId: String): String { + public function place_order (body: Order): String { // create path and map variables - var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId)); + var path: String = "/store/order".replace(/{format}/g,"xml"); // query params var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); + var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); token.requestId = requestId; - token.completionEventType = "delete_order"; + token.completionEventType = "place_order"; - token.returnType = null ; + token.returnType = Order; return requestId; } - } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/api/UserApi.as b/samples/client/petstore/flash/flash/src/io/swagger/client/api/UserApi.as index 06b0d079799..bdb91069461 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/api/UserApi.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/api/UserApi.as @@ -26,11 +26,11 @@ public class UserApi extends SwaggerApi { public static const event_create_user: String = "create_user"; public static const event_create_users_with_array_input: String = "create_users_with_array_input"; public static const event_create_users_with_list_input: String = "create_users_with_list_input"; + public static const event_delete_user: String = "delete_user"; + public static const event_get_user_by_name: String = "get_user_by_name"; public static const event_login_user: String = "login_user"; public static const event_logout_user: String = "logout_user"; - public static const event_get_user_by_name: String = "get_user_by_name"; public static const event_update_user: String = "update_user"; - public static const event_delete_user: String = "delete_user"; /* @@ -44,12 +44,13 @@ public class UserApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); @@ -61,7 +62,7 @@ public class UserApi extends SwaggerApi { return requestId; } - + /* * Returns void */ @@ -73,12 +74,13 @@ public class UserApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); @@ -90,7 +92,7 @@ public class UserApi extends SwaggerApi { return requestId; } - + /* * Returns void */ @@ -102,12 +104,13 @@ public class UserApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams); var requestId: String = getUniqueId(); @@ -119,127 +122,7 @@ public class UserApi extends SwaggerApi { return requestId; } - - /* - * Returns String - */ - public function login_user (username: String, password: String): String { - // create path and map variables - var path: String = "/user/login".replace(/{format}/g,"xml"); - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - if("null" != String(username)) - queryParams["username"] = toPathValue(username); - if("null" != String(password)) - queryParams["password"] = toPathValue(password); - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "login_user"; - - token.returnType = String; - return requestId; - - } - - /* - * Returns void - */ - public function logout_user (): String { - // create path and map variables - var path: String = "/user/logout".replace(/{format}/g,"xml"); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "logout_user"; - - token.returnType = null ; - return requestId; - - } - - /* - * Returns User - */ - public function get_user_by_name (username: String): String { - // create path and map variables - var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "get_user_by_name"; - - token.returnType = User; - return requestId; - - } - - /* - * Returns void - */ - public function update_user (username: String, body: User): String { - // create path and map variables - var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); - - // query params - var queryParams: Dictionary = new Dictionary(); - var headerParams: Dictionary = new Dictionary(); - - - - - - - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams); - - var requestId: String = getUniqueId(); - - token.requestId = requestId; - token.completionEventType = "update_user"; - - token.returnType = null ; - return requestId; - - } - /* * Returns void */ @@ -251,12 +134,13 @@ public class UserApi extends SwaggerApi { var queryParams: Dictionary = new Dictionary(); var headerParams: Dictionary = new Dictionary(); - + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } - - var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams); var requestId: String = getUniqueId(); @@ -268,7 +152,133 @@ public class UserApi extends SwaggerApi { return requestId; } - -} + + /* + * Returns User + */ + public function get_user_by_name (username: String): String { + // create path and map variables + var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "get_user_by_name"; + + token.returnType = User; + return requestId; + + } + + /* + * Returns String + */ + public function login_user (username: String, password: String): String { + // create path and map variables + var path: String = "/user/login".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if( // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } + + if("null" != String(username)) + queryParams["username"] = toPathValue(username); +if("null" != String(password)) + queryParams["password"] = toPathValue(password); + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "login_user"; + + token.returnType = String; + return requestId; + + } + + /* + * Returns void + */ + public function logout_user (): String { + // create path and map variables + var path: String = "/user/logout".replace(/{format}/g,"xml"); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "GET", queryParams, null, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "logout_user"; + + token.returnType = null ; + return requestId; + + } + + /* + * Returns void + */ + public function update_user (username: String, body: User): String { + // create path and map variables + var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); + + // query params + var queryParams: Dictionary = new Dictionary(); + var headerParams: Dictionary = new Dictionary(); + + // verify required params are set + if( // verify required params are set + if() { + throw new ApiError(400, "missing required params"); + } +) { + throw new ApiError(400, "missing required params"); + } + + + + var token:AsyncToken = getApiInvoker().invokeAPI(path, "PUT", queryParams, body, headerParams); + + var requestId: String = getUniqueId(); + + token.requestId = requestId; + token.completionEventType = "update_user"; + + token.returnType = null ; + return requestId; + + } +} } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Category.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Category.as index 6aa73414387..76916ee0b9e 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Category.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Category.as @@ -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; } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/CategoryList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/CategoryList.as index 342cd70c001..4bf21454d29 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/CategoryList.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/CategoryList.as @@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper; } } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Order.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Order.as index d6e4e6dc4d7..bcb3855496c 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Order.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Order.as @@ -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; } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/OrderList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/OrderList.as index bba3d8a4724..3573a1b4863 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/OrderList.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/OrderList.as @@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper; } } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Pet.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Pet.as index a4a7d04830f..6c14f3f83e4 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Pet.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Pet.as @@ -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; } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/PetList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/PetList.as index ada0846c5ea..c1dcc0cfb6c 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/PetList.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/PetList.as @@ -15,6 +15,5 @@ import io.swagger.client.model.Tag; } } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Tag.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Tag.as index 7387e2e2745..3c8c4cae466 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/Tag.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/Tag.as @@ -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; } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/TagList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/TagList.as index 25ebadb27fb..b958cae23b3 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/TagList.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/TagList.as @@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper; } } - } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/User.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/User.as index 2b6474de90c..fadf5f4e7a3 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/User.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/User.as @@ -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; } diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/model/UserList.as b/samples/client/petstore/flash/flash/src/io/swagger/client/model/UserList.as index e8a1fdb27f6..a8404427adf 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/model/UserList.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/model/UserList.as @@ -13,6 +13,5 @@ import io.swagger.common.ListWrapper; } } - } diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala index 7028969b90f..68bb44e3b47 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -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") + } diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala index 566dbc42c12..55e3e32d195 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/StoreApi.scala @@ -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") + } diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala index b15e6973d3c..11ae02af0af 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/UserApi.scala @@ -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") + }