forked from loafle/openapi-generator-original
replace requiredParam with reuqired
This commit is contained in:
@@ -2,7 +2,7 @@ package io.swagger.client
|
||||
|
||||
import io.swagger.client.api._
|
||||
|
||||
import io.swagger.client._
|
||||
import com.wordnik.swagger.client._
|
||||
|
||||
import java.io.Closeable
|
||||
|
||||
@@ -14,14 +14,14 @@ class SwaggerClient(config: SwaggerConfig) extends Closeable {
|
||||
|
||||
protected def transportClient: TransportClient = new RestClient(config)
|
||||
|
||||
val user = new UserApi(client, config)
|
||||
|
||||
val pet = new PetApi(client, config)
|
||||
|
||||
val store = new StoreApi(client, config)
|
||||
|
||||
val user = new UserApi(client, config)
|
||||
|
||||
|
||||
def close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,15 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Pet
|
||||
import io.swagger.client.model.Inline_response_200
|
||||
import io.swagger.client.model.Binary
|
||||
import java.io.File
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def updatePet(body: Option[Pet] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def addPet(body: Option[Pet] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
@@ -41,7 +19,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +33,56 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def addPetUsingByteArray(body: Option[Binary] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Binary]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet?testing_byte_array=true"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def deletePet(petId: Long,
|
||||
apiKey: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey.toString
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def findPetsByStatus(status: Option[List[String]] = Some(available)
|
||||
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
@@ -63,7 +92,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
if(status != null) status.foreach { v => queryParams += "status" -> v.toString }
|
||||
|
||||
@@ -75,7 +106,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def findPetsByTags(tags: Option[List[String]] = None
|
||||
)(implicit reader: ClientResponseReader[List[Pet]]): Future[List[Pet]] = {
|
||||
// create path and map variables
|
||||
@@ -85,7 +115,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
if(tags != null) tags.foreach { v => queryParams += "tags" -> v.toString }
|
||||
|
||||
@@ -97,7 +129,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getPetById(petId: Long)(implicit reader: ClientResponseReader[Pet]): Future[Pet] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
@@ -107,7 +138,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +152,75 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getPetByIdInObject(petId: Long)(implicit reader: ClientResponseReader[Inline_response_200]): Future[Inline_response_200] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}?response=inline_arbitrary_object")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def petPetIdtestingByteArraytrueGet(petId: Long)(implicit reader: ClientResponseReader[Binary]): Future[Binary] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}?testing_byte_array=true")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def updatePet(body: Option[Pet] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def updatePetWithForm(petId: String,
|
||||
name: Option[String] = None,
|
||||
status: Option[String] = None
|
||||
@@ -132,7 +233,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -144,31 +251,6 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deletePet(petId: Long,
|
||||
apiKey: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/pet/{petId}")
|
||||
replaceAll ("\\{" + "petId" + "\\}",petId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey.toString
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def uploadFile(petId: Long,
|
||||
additionalMetadata: Option[String] = None,
|
||||
file: Option[File] = None
|
||||
@@ -181,7 +263,13 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -193,6 +281,5 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,59 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Order
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import io.swagger.client.model.Any
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def findOrdersByStatus(status: Option[String] = Some(placed)
|
||||
)(implicit reader: ClientResponseReader[List[Order]]): Future[List[Order]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/findByStatus"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
if(status != null) status.foreach { v => queryParams += "status" -> v.toString }
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def getInventory()(implicit reader: ClientResponseReader[Map[String, Integer]]): Future[Map[String, Integer]] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/inventory"))
|
||||
@@ -29,33 +74,9 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def placeOrder(body: Option[Order] = None
|
||||
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||
def getInventoryInObject()(implicit reader: ClientResponseReader[Any]): Future[Any] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
val path = (addFmt("/store/inventory?response=arbitrary_object"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
@@ -73,8 +94,7 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteOrder(orderId: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
def getOrderById(orderId: String)(implicit reader: ClientResponseReader[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order/{orderId}")
|
||||
replaceAll ("\\{" + "orderId" + "\\}",orderId.toString))
|
||||
@@ -83,18 +103,42 @@ class StoreApi(client: TransportClient, config: SwaggerConfig) extends ApiClient
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def placeOrder(body: Option[Order] = None
|
||||
)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/store/order"))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.User
|
||||
import io.swagger.client._
|
||||
import scala.concurrent.{ Future, Await }
|
||||
import scala.concurrent.duration._
|
||||
import com.wordnik.swagger.client._
|
||||
import scala.concurrent.Future
|
||||
import collection.mutable
|
||||
|
||||
class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
|
||||
|
||||
|
||||
def createUser(body: Option[User] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
@@ -18,7 +16,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def createUsersWithArrayInput(body: Option[List[User]] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
@@ -40,7 +39,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +53,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def createUsersWithListInput(body: Option[List[User]] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
@@ -62,7 +62,9 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +76,52 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
def loginUser(username: Option[String] = None,
|
||||
password: Option[String] = None
|
||||
)(implicit reader: ClientResponseReader[String]): Future[String] = {
|
||||
@@ -85,7 +132,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
if(username != null) username.foreach { v => queryParams += "username" -> v.toString }if(password != null) password.foreach { v => queryParams += "password" -> v.toString }
|
||||
|
||||
@@ -97,7 +148,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def logoutUser()(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/logout"))
|
||||
@@ -118,29 +168,6 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def getUserByName(username: String)(implicit reader: ClientResponseReader[User]): Future[User] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def updateUser(username: String,
|
||||
body: Option[User] = None
|
||||
)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
|
||||
@@ -152,7 +179,11 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
// verify required params are set
|
||||
val paramCount = (Set[Any](// verify required params are set
|
||||
val paramCount = (Set[Any]() - null).size
|
||||
if (paramCount != ) sys.error("missing required params")) - null).size
|
||||
if (paramCount != ) sys.error("missing required params")
|
||||
|
||||
|
||||
|
||||
@@ -164,28 +195,5 @@ class UserApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def deleteUser(username: String)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
|
||||
// create path and map variables
|
||||
val path = (addFmt("/user/{username}")
|
||||
replaceAll ("\\{" + "username" + "\\}",username.toString))
|
||||
|
||||
// query params
|
||||
val queryParams = new mutable.HashMap[String, String]
|
||||
val headerParams = new mutable.HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
|
||||
resFuture flatMap { resp =>
|
||||
process(reader.read(resp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Integer,
|
||||
shipDate: DateTime,
|
||||
status: String, // Order Status
|
||||
complete: Boolean
|
||||
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
||||
quantity: Option[Integer],
|
||||
shipDate: Option[DateTime],
|
||||
status: Option[String], // Order Status
|
||||
complete: Option[Boolean]
|
||||
)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String // pet status in the store
|
||||
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: Option[List[Tag]],
|
||||
status: Option[String] // pet status in the store
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
||||
)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package io.swagger.client.model
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Integer // User Status
|
||||
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
||||
firstName: Option[String],
|
||||
lastName: Option[String],
|
||||
email: Option[String],
|
||||
password: Option[String],
|
||||
phone: Option[String],
|
||||
userStatus: Option[Integer] // User Status
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user