forked from loafle/openapi-generator-original
rebuilt
This commit is contained in:
@@ -3,10 +3,10 @@ organization := ""
|
||||
name := "-client"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"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",
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"junit" % "junit" % "4.11" % "test"
|
||||
"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"
|
||||
)
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package io.swagger.client
|
||||
|
||||
import io.swagger.client.api._
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
private[this] val client = transportClient
|
||||
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
|
||||
protected def transportClient: TransportClient = new RestClient(config)
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Pet
|
||||
import java.io.File
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import collection.mutable
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.concurrent.Future
|
||||
|
||||
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] = {
|
||||
@@ -50,7 +52,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
|
||||
|
||||
def findPetsByStatus(status: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
def findPetsByStatus(status: List[String] = available)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/findByStatus"))
|
||||
|
||||
@@ -61,7 +63,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
|
||||
|
||||
|
||||
if (status != null) queryParams += "status" -> status.toString
|
||||
if(status != null) queryParams += "status" -> status.toString
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +85,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
|
||||
|
||||
|
||||
if (tags != null) queryParams += "tags" -> tags.toString
|
||||
if(tags != null) queryParams += "tags" -> tags.toString
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +99,7 @@ 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}")
|
||||
replaceAll("\\{" + "petId" + "\\}", petId.toString))
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -121,7 +123,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
status: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll("\\{" + "petId" + "\\}", petId.toString))
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -140,11 +142,11 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
|
||||
|
||||
def deletePet(api_key: String,
|
||||
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))
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -154,7 +156,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> api_key.toString
|
||||
headerParams += "api_key" -> apiKey.toString
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
@@ -168,7 +170,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
file: File)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}/uploadImage")
|
||||
replaceAll("\\{" + "petId" + "\\}", petId.toString))
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -187,4 +189,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.concurrent.Future
|
||||
import io.swagger.client.model.Order
|
||||
import io.swagger.client._
|
||||
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]] = {
|
||||
@@ -51,7 +54,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
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))
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -73,7 +76,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
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))
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -92,4 +95,5 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.concurrent.Future
|
||||
import io.swagger.client.model.User
|
||||
import io.swagger.client._
|
||||
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] = {
|
||||
@@ -81,8 +84,8 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
|
||||
|
||||
|
||||
if (username != null) queryParams += "username" -> username.toString
|
||||
if (password != null) queryParams += "password" -> password.toString
|
||||
if(username != null) queryParams += "username" -> username.toString
|
||||
if(password != null) queryParams += "password" -> password.toString
|
||||
|
||||
|
||||
|
||||
@@ -117,7 +120,7 @@ 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))
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -140,7 +143,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
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))
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -162,7 +165,7 @@ 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))
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -181,4 +184,5 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Category(
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Order(
|
||||
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
@@ -10,3 +13,4 @@ case class Order(
|
||||
complete: Boolean
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Pet(
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
@@ -10,3 +13,4 @@ case class Pet(
|
||||
status: String // pet status in the store
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class Tag(
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
|
||||
case class User(
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
@@ -12,3 +15,4 @@ case class User(
|
||||
userStatus: Integer // User Status
|
||||
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user