forked from loafle/openapi-generator-original
fix perl and asyncscala optional tab
This commit is contained in:
@@ -3,10 +3,10 @@ organization := ""
|
||||
name := "-client"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.wordnik" %% "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",
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"junit" % "junit" % "4.11" % "test"
|
||||
"io.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",
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"junit" % "junit" % "4.11" % "test"
|
||||
)
|
||||
|
||||
@@ -7,21 +7,21 @@ import io.swagger.client._
|
||||
import java.io.Closeable
|
||||
|
||||
class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
||||
val locator = config.locator
|
||||
val name = config.name
|
||||
val locator = config.locator
|
||||
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)
|
||||
|
||||
val pet = new PetApi(client, config)
|
||||
|
||||
val store = new StoreApi(client, config)
|
||||
|
||||
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
@@ -7,187 +7,191 @@ import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
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] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
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: 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))
|
||||
}
|
||||
}
|
||||
// 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
|
||||
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 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]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/inventory"))
|
||||
|
||||
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/inventory"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def placeOrder(body: 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))
|
||||
}
|
||||
}
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def placeOrder(body: Option[Order] = None
|
||||
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
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 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] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user"))
|
||||
|
||||
def createUser(body: Option[User] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user"))
|
||||
|
||||
// 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 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))
|
||||
}
|
||||
}
|
||||
// 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 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
|
||||
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
@@ -3,14 +3,12 @@ package io.swagger.client.model
|
||||
import org.joda.time.DateTime
|
||||
|
||||
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
shipDate: DateTime,
|
||||
status: String, // Order Status
|
||||
complete: Boolean
|
||||
|
||||
)
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
shipDate: DateTime,
|
||||
status: String, // Order Status
|
||||
complete: Boolean
|
||||
|
||||
)
|
||||
|
||||
@@ -3,14 +3,12 @@ package io.swagger.client.model
|
||||
import org.joda.time.DateTime
|
||||
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String // pet status in the store
|
||||
|
||||
)
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String // pet status in the store
|
||||
|
||||
)
|
||||
|
||||
@@ -3,10 +3,8 @@ package io.swagger.client.model
|
||||
import org.joda.time.DateTime
|
||||
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
@@ -3,16 +3,14 @@ package io.swagger.client.model
|
||||
import org.joda.time.DateTime
|
||||
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Integer // User Status
|
||||
|
||||
)
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Integer // User Status
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user