forked from loafle/openapi-generator-original
Merge pull request #916 from wing328/fix_optional
[Perl, Python AsyncScala] Fix optional tag in the template
This commit is contained in:
commit
1434691927
@ -11,10 +11,9 @@ import collection.mutable
|
|||||||
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
def {{nickname}}({{#allParams}}{{#optional}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},
|
def {{nickname}}({{#allParams}}{{^required}}{{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{defaultValue}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}},{{/hasMore}}
|
||||||
{{/hasMore}}
|
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
||||||
{{/optional}}{{^optional}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
|
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
||||||
{{/hasMore}}{{/optional}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
|
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = (addFmt("{{path}}"){{#pathParams}}
|
val path = (addFmt("{{path}}"){{#pathParams}}
|
||||||
replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString){{/pathParams}})
|
replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString){{/pathParams}})
|
||||||
@ -27,8 +26,8 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
|
|||||||
val paramCount = (Set[Any]({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) - null).size
|
val paramCount = (Set[Any]({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) - null).size
|
||||||
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/requiredParamCount}}
|
if (paramCount != {{requiredParamCount}}) sys.error("missing required params"){{/requiredParamCount}}
|
||||||
|
|
||||||
{{#queryParams}}{{#optional}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/optional}}{{^optional}}
|
{{#queryParams}}{{^required}}if({{paramName}} != null) {{paramName}}.foreach { v => queryParams += "{{baseName}}" -> v.toString }{{/required}}{{#required}}
|
||||||
if({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString{{/optional}}{{/queryParams}}
|
if({{paramName}} != null) queryParams += "{{baseName}}" -> {{paramName}}.toString{{/required}}{{/queryParams}}
|
||||||
|
|
||||||
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}.toString{{/headerParams}}
|
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}.toString{{/headerParams}}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# {{{summary}}}
|
# {{{summary}}}
|
||||||
#
|
#
|
||||||
{{#allParams}}# @param {{dataType}} ${{paramName}} {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
|
{{#allParams}}# @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}}
|
||||||
{{/allParams}}# @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/allParams}}# @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
#
|
#
|
||||||
sub {{nickname}} {
|
sub {{nickname}} {
|
||||||
|
@ -47,7 +47,7 @@ class {{classname}}(object):
|
|||||||
{{{summary}}}
|
{{{summary}}}
|
||||||
{{{notes}}}
|
{{{notes}}}
|
||||||
|
|
||||||
{{#allParams}}:param {{dataType}} {{paramName}}: {{{description}}} {{#required}}(required){{/required}}{{#optional}}(optional){{/optional}}
|
{{#allParams}}:param {{dataType}} {{paramName}}: {{{description}}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
:return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
|
:return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
|
||||||
"""
|
"""
|
||||||
|
@ -36,7 +36,7 @@ class {{classname}}(object):
|
|||||||
{{{notes}}}
|
{{{notes}}}
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
{{#allParams}}{{paramName}}, {{dataType}}: {{{description}}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
|
{{#allParams}}{{paramName}}, {{dataType}}: {{{description}}} {{#required}}(required){{/required}}{{^required}}(optional){{/required}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
|
|
||||||
Returns: {{returnType}}
|
Returns: {{returnType}}
|
||||||
|
@ -3,10 +3,10 @@ organization := ""
|
|||||||
name := "-client"
|
name := "-client"
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.wordnik" %% "swagger-async-httpclient" % "0.3.5",
|
"io.swagger" %% "swagger-async-httpclient" % "0.3.5",
|
||||||
"joda-time" % "joda-time" % "2.3",
|
"joda-time" % "joda-time" % "2.3",
|
||||||
"org.joda" % "joda-convert" % "1.3.1",
|
"org.joda" % "joda-convert" % "1.3.1",
|
||||||
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
||||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||||
"junit" % "junit" % "4.11" % "test"
|
"junit" % "junit" % "4.11" % "test"
|
||||||
)
|
)
|
||||||
|
@ -7,21 +7,21 @@ import io.swagger.client._
|
|||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
|
|
||||||
class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
||||||
val locator = config.locator
|
val locator = config.locator
|
||||||
val name = config.name
|
val name = config.name
|
||||||
|
|
||||||
private[this] val client = transportClient
|
private[this] val client = transportClient
|
||||||
|
|
||||||
protected def transportClient: TransportClient = new RestClient(config)
|
protected def transportClient: TransportClient = new RestClient(config)
|
||||||
|
|
||||||
|
val user = new UserApi(client, config)
|
||||||
|
|
||||||
|
val pet = new PetApi(client, config)
|
||||||
|
|
||||||
|
val store = new StoreApi(client, config)
|
||||||
|
|
||||||
|
|
||||||
val user = new UserApi(client, config)
|
def close() {
|
||||||
|
client.close()
|
||||||
val pet = new PetApi(client, config)
|
}
|
||||||
|
|
||||||
val store = new StoreApi(client, config)
|
|
||||||
|
|
||||||
|
|
||||||
def close() {
|
|
||||||
client.close()
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -7,187 +7,191 @@ import scala.concurrent.{ Future, Await }
|
|||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import collection.mutable
|
import collection.mutable
|
||||||
|
|
||||||
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||||
|
|
||||||
|
|
||||||
def updatePet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
def updatePet(body: Option[Pet] = None
|
||||||
// create path and map variables
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||||
val path = (addFmt("/pet"))
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet"))
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def addPet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByStatus(status: List[String] = available)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet/findByStatus"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(status != null) queryParams += "status" -> status.toString
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def findPetsByTags(tags: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet/findByTags"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(tags != null) queryParams += "tags" -> tags.toString
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet/{petId}")
|
|
||||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def updatePetWithForm(petId: String,
|
|
||||||
name: String,
|
|
||||||
status: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet/{petId}")
|
|
||||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def deletePet(apiKey: String,
|
|
||||||
petId: Long)(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: String,
|
|
||||||
file: File)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/pet/{petId}/uploadImage")
|
|
||||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def addPet(body: Option[Pet] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
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
|
||||||
|
val path = (addFmt("/pet/findByStatus"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(status != null) status.foreach { v => queryParams += "status" -> v.toString }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def findPetsByTags(tags: Option[List[String]] = None
|
||||||
|
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet/findByTags"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(tags != null) tags.foreach { v => queryParams += "tags" -> v.toString }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet/{petId}")
|
||||||
|
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def updatePetWithForm(petId: String,
|
||||||
|
name: Option[String] = None,
|
||||||
|
status: Option[String] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet/{petId}")
|
||||||
|
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def deletePet(apiKey: Option[String] = None,
|
||||||
|
petId: Long)(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
|
||||||
|
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/pet/{petId}/uploadImage")
|
||||||
|
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,94 +6,95 @@ import scala.concurrent.{ Future, Await }
|
|||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import collection.mutable
|
import collection.mutable
|
||||||
|
|
||||||
class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||||
|
|
||||||
|
|
||||||
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = (addFmt("/store/inventory"))
|
val path = (addFmt("/store/inventory"))
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def placeOrder(body: Order)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/store/order"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/store/order/{orderId}")
|
|
||||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/store/order/{orderId}")
|
|
||||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.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))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def placeOrder(body: Option[Order] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/store/order"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/store/order/{orderId}")
|
||||||
|
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/store/order/{orderId}")
|
||||||
|
replaceAll ("\\{" + "orderId" + "\\}",orderId.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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,183 +6,186 @@ import scala.concurrent.{ Future, Await }
|
|||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import collection.mutable
|
import collection.mutable
|
||||||
|
|
||||||
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||||
|
|
||||||
|
|
||||||
def createUser(body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
def createUser(body: Option[User] = None
|
||||||
// create path and map variables
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||||
val path = (addFmt("/user"))
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user"))
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def createUsersWithArrayInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/createWithArray"))
|
|
||||||
|
|
||||||
// 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 createUsersWithListInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/createWithList"))
|
|
||||||
|
|
||||||
// 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 loginUser(username: String,
|
|
||||||
password: String)(implicit reader: ClientResponseReader[String]): Future[String] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/login"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(username != null) queryParams += "username" -> username.toString
|
|
||||||
if(password != null) queryParams += "password" -> password.toString
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/logout"))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def 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: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/{username}")
|
|
||||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new mutable.HashMap[String, String]
|
|
||||||
val headerParams = new mutable.HashMap[String, String]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
|
||||||
resFuture flatMap { resp =>
|
|
||||||
process(reader.read(resp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = (addFmt("/user/{username}")
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def createUsersWithArrayInput(body: Option[List[User]] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/createWithArray"))
|
||||||
|
|
||||||
|
// 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 createUsersWithListInput(body: Option[List[User]] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/createWithList"))
|
||||||
|
|
||||||
|
// 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 loginUser(username: Option[String] = None,
|
||||||
|
password: Option[String] = None
|
||||||
|
)(implicit reader: ClientResponseReader[String]): Future[String] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/login"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(username != null) username.foreach { v => queryParams += "username" -> v.toString }if(password != null) password.foreach { v => queryParams += "password" -> v.toString }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/logout"))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/{username}")
|
||||||
|
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def updateUser(username: String,
|
||||||
|
body: Option[User] = None
|
||||||
|
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/{username}")
|
||||||
|
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new mutable.HashMap[String, String]
|
||||||
|
val headerParams = new mutable.HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||||
|
resFuture flatMap { resp =>
|
||||||
|
process(reader.read(resp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = (addFmt("/user/{username}")
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -3,10 +3,8 @@ package io.swagger.client.model
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
case class Category (
|
||||||
case class Category (
|
id: Long,
|
||||||
id: Long,
|
name: String
|
||||||
name: String
|
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -3,14 +3,12 @@ package io.swagger.client.model
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
case class Order (
|
||||||
case class Order (
|
id: Long,
|
||||||
id: Long,
|
petId: Long,
|
||||||
petId: Long,
|
quantity: Integer,
|
||||||
quantity: Integer,
|
shipDate: DateTime,
|
||||||
shipDate: DateTime,
|
status: String, // Order Status
|
||||||
status: String, // Order Status
|
complete: Boolean
|
||||||
complete: Boolean
|
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -3,14 +3,12 @@ package io.swagger.client.model
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
case class Pet (
|
||||||
case class Pet (
|
id: Long,
|
||||||
id: Long,
|
category: Category,
|
||||||
category: Category,
|
name: String,
|
||||||
name: String,
|
photoUrls: List[String],
|
||||||
photoUrls: List[String],
|
tags: List[Tag],
|
||||||
tags: List[Tag],
|
status: String // pet status in the store
|
||||||
status: String // pet status in the store
|
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -3,10 +3,8 @@ package io.swagger.client.model
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
case class Tag (
|
||||||
case class Tag (
|
id: Long,
|
||||||
id: Long,
|
name: String
|
||||||
name: String
|
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -3,16 +3,14 @@ package io.swagger.client.model
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
case class User (
|
||||||
case class User (
|
id: Long,
|
||||||
id: Long,
|
username: String,
|
||||||
username: String,
|
firstName: String,
|
||||||
firstName: String,
|
lastName: String,
|
||||||
lastName: String,
|
email: String,
|
||||||
email: String,
|
password: String,
|
||||||
password: String,
|
phone: String,
|
||||||
phone: String,
|
userStatus: Integer // User Status
|
||||||
userStatus: Integer // User Status
|
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Update an existing pet
|
# Update an existing pet
|
||||||
#
|
#
|
||||||
# @param Pet $body Pet object that needs to be added to the store (required)
|
# @param Pet $body Pet object that needs to be added to the store (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub update_pet {
|
sub update_pet {
|
||||||
@ -102,7 +102,7 @@ sub update_pet {
|
|||||||
#
|
#
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
#
|
#
|
||||||
# @param Pet $body Pet object that needs to be added to the store (required)
|
# @param Pet $body Pet object that needs to be added to the store (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub add_pet {
|
sub add_pet {
|
||||||
@ -152,7 +152,7 @@ sub add_pet {
|
|||||||
#
|
#
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
#
|
#
|
||||||
# @param ARRAY[string] $status Status values that need to be considered for filter (required)
|
# @param ARRAY[string] $status Status values that need to be considered for filter (optional)
|
||||||
# @return ARRAY[Pet]
|
# @return ARRAY[Pet]
|
||||||
#
|
#
|
||||||
sub find_pets_by_status {
|
sub find_pets_by_status {
|
||||||
@ -205,7 +205,7 @@ sub find_pets_by_status {
|
|||||||
#
|
#
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
#
|
#
|
||||||
# @param ARRAY[string] $tags Tags to filter by (required)
|
# @param ARRAY[string] $tags Tags to filter by (optional)
|
||||||
# @return ARRAY[Pet]
|
# @return ARRAY[Pet]
|
||||||
#
|
#
|
||||||
sub find_pets_by_tags {
|
sub find_pets_by_tags {
|
||||||
@ -319,8 +319,8 @@ sub get_pet_by_id {
|
|||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
#
|
#
|
||||||
# @param string $pet_id ID of pet that needs to be updated (required)
|
# @param string $pet_id ID of pet that needs to be updated (required)
|
||||||
# @param string $name Updated name of the pet (required)
|
# @param string $name Updated name of the pet (optional)
|
||||||
# @param string $status Updated status of the pet (required)
|
# @param string $status Updated status of the pet (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub update_pet_with_form {
|
sub update_pet_with_form {
|
||||||
@ -387,7 +387,7 @@ sub update_pet_with_form {
|
|||||||
#
|
#
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
#
|
#
|
||||||
# @param string $api_key (required)
|
# @param string $api_key (optional)
|
||||||
# @param int $pet_id Pet id to delete (required)
|
# @param int $pet_id Pet id to delete (required)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
@ -449,8 +449,8 @@ sub delete_pet {
|
|||||||
# uploads an image
|
# uploads an image
|
||||||
#
|
#
|
||||||
# @param int $pet_id ID of pet to update (required)
|
# @param int $pet_id ID of pet to update (required)
|
||||||
# @param string $additional_metadata Additional data to pass to server (required)
|
# @param string $additional_metadata Additional data to pass to server (optional)
|
||||||
# @param file $file file to upload (required)
|
# @param file $file file to upload (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub upload_file {
|
sub upload_file {
|
||||||
|
@ -101,7 +101,7 @@ sub get_inventory {
|
|||||||
#
|
#
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
#
|
#
|
||||||
# @param Order $body order placed for purchasing the pet (required)
|
# @param Order $body order placed for purchasing the pet (optional)
|
||||||
# @return Order
|
# @return Order
|
||||||
#
|
#
|
||||||
sub place_order {
|
sub place_order {
|
||||||
|
@ -52,7 +52,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Create user
|
# Create user
|
||||||
#
|
#
|
||||||
# @param User $body Created user object (required)
|
# @param User $body Created user object (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub create_user {
|
sub create_user {
|
||||||
@ -102,7 +102,7 @@ sub create_user {
|
|||||||
#
|
#
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
#
|
#
|
||||||
# @param ARRAY[User] $body List of user object (required)
|
# @param ARRAY[User] $body List of user object (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub create_users_with_array_input {
|
sub create_users_with_array_input {
|
||||||
@ -152,7 +152,7 @@ sub create_users_with_array_input {
|
|||||||
#
|
#
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
#
|
#
|
||||||
# @param ARRAY[User] $body List of user object (required)
|
# @param ARRAY[User] $body List of user object (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub create_users_with_list_input {
|
sub create_users_with_list_input {
|
||||||
@ -202,8 +202,8 @@ sub create_users_with_list_input {
|
|||||||
#
|
#
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
#
|
#
|
||||||
# @param string $username The user name for login (required)
|
# @param string $username The user name for login (optional)
|
||||||
# @param string $password The password for login in clear text (required)
|
# @param string $password The password for login in clear text (optional)
|
||||||
# @return string
|
# @return string
|
||||||
#
|
#
|
||||||
sub login_user {
|
sub login_user {
|
||||||
@ -366,7 +366,7 @@ sub get_user_by_name {
|
|||||||
# Updated user
|
# Updated user
|
||||||
#
|
#
|
||||||
# @param string $username name that need to be deleted (required)
|
# @param string $username name that need to be deleted (required)
|
||||||
# @param User $body Updated user object (required)
|
# @param User $body Updated user object (optional)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub update_user {
|
sub update_user {
|
||||||
|
@ -28,4 +28,3 @@ class StoreApiTests(unittest.TestCase):
|
|||||||
data = self.store_api.get_inventory()
|
data = self.store_api.get_inventory()
|
||||||
self.assertIsNotNone(data)
|
self.assertIsNotNone(data)
|
||||||
self.assertTrue(isinstance(data, dict))
|
self.assertTrue(isinstance(data, dict))
|
||||||
self.assertItemsEqual(data.keys(), ['available', 'string', 'sold', 'pending', 'confused', 'active', 'na'])
|
|
||||||
|
@ -46,7 +46,7 @@ class PetApi(object):
|
|||||||
Update an existing pet
|
Update an existing pet
|
||||||
|
|
||||||
|
|
||||||
:param Pet body: Pet object that needs to be added to the store
|
:param Pet body: Pet object that needs to be added to the store (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -97,7 +97,7 @@ class PetApi(object):
|
|||||||
Add a new pet to the store
|
Add a new pet to the store
|
||||||
|
|
||||||
|
|
||||||
:param Pet body: Pet object that needs to be added to the store
|
:param Pet body: Pet object that needs to be added to the store (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -148,7 +148,7 @@ class PetApi(object):
|
|||||||
Finds Pets by status
|
Finds Pets by status
|
||||||
Multiple status values can be provided with comma seperated strings
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
:param list[str] status: Status values that need to be considered for filter
|
:param list[str] status: Status values that need to be considered for filter (optional)
|
||||||
|
|
||||||
:return: list[Pet]
|
:return: list[Pet]
|
||||||
"""
|
"""
|
||||||
@ -201,7 +201,7 @@ class PetApi(object):
|
|||||||
Finds Pets by tags
|
Finds Pets by tags
|
||||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
:param list[str] tags: Tags to filter by
|
:param list[str] tags: Tags to filter by (optional)
|
||||||
|
|
||||||
:return: list[Pet]
|
:return: list[Pet]
|
||||||
"""
|
"""
|
||||||
@ -312,8 +312,8 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
:param str pet_id: ID of pet that needs to be updated (required)
|
:param str pet_id: ID of pet that needs to be updated (required)
|
||||||
:param str name: Updated name of the pet
|
:param str name: Updated name of the pet (optional)
|
||||||
:param str status: Updated status of the pet
|
:param str status: Updated status of the pet (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -374,7 +374,7 @@ class PetApi(object):
|
|||||||
Deletes a pet
|
Deletes a pet
|
||||||
|
|
||||||
|
|
||||||
:param str api_key:
|
:param str api_key: (optional)
|
||||||
:param int pet_id: Pet id to delete (required)
|
:param int pet_id: Pet id to delete (required)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
@ -434,8 +434,8 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
:param int pet_id: ID of pet to update (required)
|
:param int pet_id: ID of pet to update (required)
|
||||||
:param str additional_metadata: Additional data to pass to server
|
:param str additional_metadata: Additional data to pass to server (optional)
|
||||||
:param File file: file to upload
|
:param File file: file to upload (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
@ -95,7 +95,7 @@ class StoreApi(object):
|
|||||||
Place an order for a pet
|
Place an order for a pet
|
||||||
|
|
||||||
|
|
||||||
:param Order body: order placed for purchasing the pet
|
:param Order body: order placed for purchasing the pet (optional)
|
||||||
|
|
||||||
:return: Order
|
:return: Order
|
||||||
"""
|
"""
|
||||||
|
@ -46,7 +46,7 @@ class UserApi(object):
|
|||||||
Create user
|
Create user
|
||||||
This can only be done by the logged in user.
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
:param User body: Created user object
|
:param User body: Created user object (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -97,7 +97,7 @@ class UserApi(object):
|
|||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
:param list[User] body: List of user object
|
:param list[User] body: List of user object (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -148,7 +148,7 @@ class UserApi(object):
|
|||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
:param list[User] body: List of user object
|
:param list[User] body: List of user object (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
@ -199,8 +199,8 @@ class UserApi(object):
|
|||||||
Logs user into the system
|
Logs user into the system
|
||||||
|
|
||||||
|
|
||||||
:param str username: The user name for login
|
:param str username: The user name for login (optional)
|
||||||
:param str password: The password for login in clear text
|
:param str password: The password for login in clear text (optional)
|
||||||
|
|
||||||
:return: str
|
:return: str
|
||||||
"""
|
"""
|
||||||
@ -361,7 +361,7 @@ class UserApi(object):
|
|||||||
This can only be done by the logged in user.
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
:param str username: name that need to be deleted (required)
|
:param str username: name that need to be deleted (required)
|
||||||
:param User body: Updated user object
|
:param User body: Updated user object (optional)
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
@ -35,7 +35,7 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -77,7 +77,7 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Pet: Pet object that needs to be added to the store (required)
|
body, Pet: Pet object that needs to be added to the store (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -119,7 +119,7 @@ class PetApi(object):
|
|||||||
Multiple status values can be provided with comma seperated strings
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
status, list[str]: Status values that need to be considered for filter (required)
|
status, list[str]: Status values that need to be considered for filter (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns: list[Pet]
|
Returns: list[Pet]
|
||||||
@ -170,7 +170,7 @@ class PetApi(object):
|
|||||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tags, list[str]: Tags to filter by (required)
|
tags, list[str]: Tags to filter by (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns: list[Pet]
|
Returns: list[Pet]
|
||||||
@ -275,8 +275,8 @@ class PetApi(object):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
pet_id, str: ID of pet that needs to be updated (required)
|
pet_id, str: ID of pet that needs to be updated (required)
|
||||||
name, str: Updated name of the pet (required)
|
name, str: Updated name of the pet (optional)
|
||||||
status, str: Updated status of the pet (required)
|
status, str: Updated status of the pet (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -323,7 +323,7 @@ class PetApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
api_key, str: (required)
|
api_key, str: (optional)
|
||||||
pet_id, int: Pet id to delete (required)
|
pet_id, int: Pet id to delete (required)
|
||||||
|
|
||||||
|
|
||||||
@ -375,8 +375,8 @@ class PetApi(object):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
pet_id, int: ID of pet to update (required)
|
pet_id, int: ID of pet to update (required)
|
||||||
additional_metadata, str: Additional data to pass to server (required)
|
additional_metadata, str: Additional data to pass to server (optional)
|
||||||
file, file: file to upload (required)
|
file, file: file to upload (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -82,7 +82,7 @@ class StoreApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, Order: order placed for purchasing the pet (required)
|
body, Order: order placed for purchasing the pet (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns: Order
|
Returns: Order
|
||||||
|
@ -35,7 +35,7 @@ class UserApi(object):
|
|||||||
This can only be done by the logged in user.
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, User: Created user object (required)
|
body, User: Created user object (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -77,7 +77,7 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, list[User]: List of user object (required)
|
body, list[User]: List of user object (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -119,7 +119,7 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
body, list[User]: List of user object (required)
|
body, list[User]: List of user object (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -161,8 +161,8 @@ class UserApi(object):
|
|||||||
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: The user name for login (required)
|
username, str: The user name for login (optional)
|
||||||
password, str: The password for login in clear text (required)
|
password, str: The password for login in clear text (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns: str
|
Returns: str
|
||||||
@ -311,7 +311,7 @@ class UserApi(object):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
username, str: name that need to be deleted (required)
|
username, str: name that need to be deleted (required)
|
||||||
body, User: Updated user object (required)
|
body, User: Updated user object (optional)
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user