Code reformatting

This commit is contained in:
Ron
2015-06-07 11:56:08 -04:00
parent 22d7db2cb4
commit 1c2d0656b0
732 changed files with 61242 additions and 55773 deletions

View File

@@ -1,27 +1,18 @@
package io.swagger.client
import io.swagger.client.api._
import com.wordnik.swagger.client._
import java.io.Closeable
class SwaggerClient(config: SwaggerConfig) extends Closeable {
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)
}

View File

@@ -1,15 +1,13 @@
package io.swagger.client.api
import io.swagger.client.model.Pet
import java.io.File
import com.wordnik.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) {
def updatePet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/pet"))
@@ -18,11 +16,11 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
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 =>
@@ -30,7 +28,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def addPet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/pet"))
@@ -39,11 +37,11 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
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 =>
@@ -51,7 +49,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def findPetsByStatus(status: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
// create path and map variables
val path = (addFmt("/pet/findByStatus"))
@@ -60,12 +58,12 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if(status != null) queryParams += "status" -> status.toString
if (status != null) queryParams += "status" -> status.toString
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -73,7 +71,7 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def findPetsByTags(tags: List[String])(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
// create path and map variables
val path = (addFmt("/pet/findByTags"))
@@ -82,12 +80,12 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if(tags != null) queryParams += "tags" -> tags.toString
if (tags != null) queryParams += "tags" -> tags.toString
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -95,21 +93,21 @@ 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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -117,23 +115,23 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def updatePetWithForm(petId: String,
name: String,
status: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
name: String,
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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -141,20 +139,20 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def deletePet(api_key: String,
petId: Long)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
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]
val headerParams = new mutable.HashMap[String, String]
headerParams += "api_key" -> api_key.toString
@@ -164,23 +162,23 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
def uploadFile(petId: Long,
additionalMetadata: String,
file: File)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
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))
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 =>
@@ -188,6 +186,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
}
}

View File

@@ -1,14 +1,11 @@
package io.swagger.client.api
import io.swagger.client.model.Order
import com.wordnik.swagger.client._
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import collection.mutable
import scala.collection.mutable
import scala.concurrent.Future
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"))
@@ -17,11 +14,11 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
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 =>
@@ -29,7 +26,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
}
}
def placeOrder(body: Order)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
// create path and map variables
val path = (addFmt("/store/order"))
@@ -38,11 +35,11 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
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 =>
@@ -50,21 +47,21 @@ 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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -72,21 +69,21 @@ 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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -94,6 +91,5 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
}
}
}

View File

@@ -1,14 +1,11 @@
package io.swagger.client.api
import io.swagger.client.model.User
import com.wordnik.swagger.client._
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import collection.mutable
import scala.collection.mutable
import scala.concurrent.Future
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"))
@@ -17,11 +14,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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 =>
@@ -29,7 +26,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
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"))
@@ -38,11 +35,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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 =>
@@ -50,7 +47,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
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"))
@@ -59,11 +56,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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 =>
@@ -71,9 +68,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
def loginUser(username: String,
password: String)(implicit reader: ClientResponseReader[String]): Future[String] = {
password: String)(implicit reader: ClientResponseReader[String]): Future[String] = {
// create path and map variables
val path = (addFmt("/user/login"))
@@ -81,13 +78,13 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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
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 =>
@@ -95,7 +92,7 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/user/logout"))
@@ -104,11 +101,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
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 =>
@@ -116,21 +113,21 @@ 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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -138,22 +135,22 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
def updateUser(username: String,
body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
resFuture flatMap { resp =>
@@ -161,21 +158,21 @@ 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]
val headerParams = new mutable.HashMap[String, String]
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
@@ -183,6 +180,5 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
}
}
}

View File

@@ -1,10 +1,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
)
)

View File

@@ -1,14 +1,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
)
)

View File

@@ -1,14 +1,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
)
)

View File

@@ -1,10 +1,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
)
)

View File

@@ -1,16 +1,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
)
)

View File

@@ -1,21 +1,8 @@
import io.swagger.client.SwaggerClient
import io.swagger.client.api._
import com.wordnik.swagger.client._
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
import org.json4s.Formats
import java.net.URI
import scala.concurrent._
import scala.concurrent.duration._
import scala.util.{Success, Failure}
import scala.concurrent.ExecutionContext.Implicits.global
import java.net.URI
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.FlatSpec
import org.scalatest.Matchers
import scala.util.{Failure, Success}
@RunWith(classOf[JUnitRunner])
class SimpleTest extends FlatSpec with Matchers {