From 9d1f0bf56842dc4ae32cad90a4e7642b0b6f3c50 Mon Sep 17 00:00:00 2001 From: "Mark H. Butler" Date: Wed, 8 Oct 2014 08:19:08 -0700 Subject: [PATCH 1/3] Adding ignore for gedit files (Linux) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b17bf46aa10..ae4c9e53c36 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ target .lib atlassian-ide-plugin.xml .DS_Store +*~ From 6f30a6d65a73391ea038429d204f43ad4b7b6238 Mon Sep 17 00:00:00 2001 From: "Mark H. Butler" Date: Wed, 8 Oct 2014 08:20:02 -0700 Subject: [PATCH 2/3] Modifying the pom.xml template because it defaults to building with Scala 2.9.1, but that is broken because BeanProperty moved, so instead use 2.10 as the default but add the option of using Scala 2.11 --- samples/client/petstore/scala/pom.xml | 23 ++- .../com/wordnik/petstore/api/PetApi.scala | 59 ++++---- .../com/wordnik/petstore/api/UserApi.scala | 132 +++++++++--------- .../scala/src/test/scala/PetApiTest.scala | 6 +- src/main/resources/scala/pom.mustache | 23 ++- 5 files changed, 129 insertions(+), 114 deletions(-) diff --git a/samples/client/petstore/scala/pom.xml b/samples/client/petstore/scala/pom.xml index bb7b19f64c1..fdd9eae1ba3 100644 --- a/samples/client/petstore/scala/pom.xml +++ b/samples/client/petstore/scala/pom.xml @@ -188,25 +188,34 @@ + + scala_2.11 + + 2.11.2 + 2.11 + 1.3.10 + 2.2.2 + + scala_2.10 + + true + 2.10.3 2.10 - 1.3.2 + 1.3.10 2.1.2 scala_2.9.1 - - true - 2.9.1-1 2.9.1 - 1.1.0 - 1.6.1 + 1.3.1 + 1.9.2 @@ -215,7 +224,7 @@ 4.8.1 1.0.0 4.8.1 - 3.1.5 + 3.2.0 diff --git a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala index 0ae8819a706..edef25d8e8f 100644 --- a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala @@ -15,7 +15,7 @@ class PetApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value - def getPetById (petId: Long) : Option[Pet]= { + def deletePet (petId: String) = { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -34,17 +34,16 @@ class PetApi { case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[Pet]).asInstanceOf[Pet]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def deletePet (petId: String) = { + def getPetById (petId: Long) : Option[Pet]= { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -63,9 +62,10 @@ class PetApi { case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[Pet]).asInstanceOf[Pet]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None @@ -132,30 +132,6 @@ class PetApi { case ex: ApiException => throw ex } } - def uploadFile (additionalMetadata: String, body: File) = { - // create path and map variables - val path = "/pet/uploadImage".replaceAll("\\{format\\}","json") - - val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } - - // query params - val queryParams = new HashMap[String, String] - val headerParams = new HashMap[String, String] - - try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { - case s: String => - case _ => None - } - } catch { - case ex: ApiException if ex.code == 404 => None - case ex: ApiException => throw ex - } - } def addPet (body: Pet) = { // create path and map variables val path = "/pet".replaceAll("\\{format\\}","json") @@ -270,5 +246,26 @@ class PetApi { case ex: ApiException => throw ex } } + def uploadFile (additionalMetadata: String, file: File) = { + // create path and map variables + val path = "/pet/uploadImage".replaceAll("\\{format\\}","json") + + val contentType = { + "application/json"} + + // query params + val queryParams = new HashMap[String, String] + val headerParams = new HashMap[String, String] + + try { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, None, headerParams.toMap, contentType) match { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } } diff --git a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala index bfeece060ef..c9d82ab2420 100644 --- a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala +++ b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala @@ -15,11 +15,9 @@ class UserApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value - def updateUser (username: String, body: User) = { + def createUser (body: User) = { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user".replaceAll("\\{format\\}","json") val contentType = { if(body != null && body.isInstanceOf[File] ) @@ -32,12 +30,12 @@ class UserApi { val headerParams = new HashMap[String, String] // verify required params are set - (List(username, body).filter(_ != null)).size match { - case 2 => // all required values set + (List(body).filter(_ != null)).size match { + case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -46,26 +44,27 @@ class UserApi { case ex: ApiException => throw ex } } - def deleteUser (username: String) = { + def createUsersWithArrayInput (body: List[User]) = { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user/createWithArray".replaceAll("\\{format\\}","json") val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username).filter(_ != null)).size match { + (List(body).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -74,67 +73,71 @@ class UserApi { case ex: ApiException => throw ex } } - def getUserByName (username: String) : Option[User]= { + def createUsersWithListInput (body: List[User]) = { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user/createWithList".replaceAll("\\{format\\}","json") val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username).filter(_ != null)).size match { + (List(body).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def loginUser (username: String, password: String) : Option[String]= { + def updateUser (username: String, body: User) = { // create path and map variables - val path = "/user/login".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username, password).filter(_ != null)).size match { + (List(username, body).filter(_ != null)).size match { case 2 => // all required values set case _ => throw new Exception("missing required params") } - if(String.valueOf(username) != "null") queryParams += "username" -> username.toString - if(String.valueOf(password) != "null") queryParams += "password" -> password.toString try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def logoutUser () = { + def deleteUser (username: String) = { // create path and map variables - val path = "/user/logout".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { "application/json"} @@ -143,8 +146,13 @@ class UserApi { val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] + // verify required params are set + (List(username).filter(_ != null)).size match { + case 1 => // all required values set + case _ => throw new Exception("missing required params") + } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -153,85 +161,77 @@ class UserApi { case ex: ApiException => throw ex } } - def createUser (body: User) = { + def getUserByName (username: String) : Option[User]= { // create path and map variables - val path = "/user".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(body).filter(_ != null)).size match { + (List(username).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def createUsersWithArrayInput (body: List[User]) = { + def loginUser (username: String, password: String) : Option[String]= { // create path and map variables - val path = "/user/createWithArray".replaceAll("\\{format\\}","json") + val path = "/user/login".replaceAll("\\{format\\}","json") val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(body).filter(_ != null)).size match { - case 1 => // all required values set + (List(username, password).filter(_ != null)).size match { + case 2 => // all required values set case _ => throw new Exception("missing required params") } + if(String.valueOf(username) != "null") queryParams += "username" -> username.toString + if(String.valueOf(password) != "null") queryParams += "password" -> password.toString try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def createUsersWithListInput (body: List[User]) = { + def logoutUser () = { // create path and map variables - val path = "/user/createWithList".replaceAll("\\{format\\}","json") + val path = "/user/logout".replaceAll("\\{format\\}","json") val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] - // verify required params are set - (List(body).filter(_ != null)).size match { - case 1 => // all required values set - case _ => throw new Exception("missing required params") - } try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => case _ => None } diff --git a/samples/client/petstore/scala/src/test/scala/PetApiTest.scala b/samples/client/petstore/scala/src/test/scala/PetApiTest.scala index adae715b462..c06a2072998 100644 --- a/samples/client/petstore/scala/src/test/scala/PetApiTest.scala +++ b/samples/client/petstore/scala/src/test/scala/PetApiTest.scala @@ -30,7 +30,7 @@ class PetApiTest extends FlatSpec with Matchers { Category(1, "sold"), "dragon", (for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList, - (for (i <- (1 to 5)) yield Tag(i, "tag-" + i)).toList, + (for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList, "lost" ) @@ -55,7 +55,7 @@ class PetApiTest extends FlatSpec with Matchers { Category(1, "sold"), "programmer", (for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList, - (for (i <- (1 to 5)) yield Tag(i, "tag-" + i)).toList, + (for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList, "confused" ) @@ -101,4 +101,4 @@ class PetApiTest extends FlatSpec with Matchers { case None => fail("didn't find pets by tag") } } -} \ No newline at end of file +} diff --git a/src/main/resources/scala/pom.mustache b/src/main/resources/scala/pom.mustache index 4cb2c261fad..d5ad2d05a09 100644 --- a/src/main/resources/scala/pom.mustache +++ b/src/main/resources/scala/pom.mustache @@ -188,25 +188,34 @@ + + scala_2.11 + + 2.11.2 + 2.11 + 1.3.10 + 2.2.2 + + scala_2.10 + + true + 2.10.3 2.10 - 1.3.2 + 1.3.10 2.1.2 scala_2.9.1 - - true - 2.9.1-1 2.9.1 - 1.1.0 - 1.6.1 + 1.3.1 + 1.9.2 @@ -215,6 +224,6 @@ 4.8.1 1.0.0 4.8.1 - 3.1.5 + 3.2.0 From c8dac4a3cf90c0ab46ea55e7ccfbd492dcee9f8b Mon Sep 17 00:00:00 2001 From: "Mark H. Butler" Date: Wed, 8 Oct 2014 08:25:23 -0700 Subject: [PATCH 3/3] Reverting these files, they don't need to change --- .../com/wordnik/petstore/api/PetApi.scala | 59 ++++---- .../com/wordnik/petstore/api/UserApi.scala | 132 +++++++++--------- 2 files changed, 97 insertions(+), 94 deletions(-) diff --git a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala index edef25d8e8f..0ae8819a706 100644 --- a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/PetApi.scala @@ -15,7 +15,7 @@ class PetApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value - def deletePet (petId: String) = { + def getPetById (petId: Long) : Option[Pet]= { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -34,16 +34,17 @@ class PetApi { case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[Pet]).asInstanceOf[Pet]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def getPetById (petId: Long) : Option[Pet]= { + def deletePet (petId: String) = { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -62,10 +63,9 @@ class PetApi { case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[Pet]).asInstanceOf[Pet]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None @@ -132,6 +132,30 @@ class PetApi { case ex: ApiException => throw ex } } + def uploadFile (additionalMetadata: String, body: File) = { + // create path and map variables + val path = "/pet/uploadImage".replaceAll("\\{format\\}","json") + + val contentType = { + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } + + // query params + val queryParams = new HashMap[String, String] + val headerParams = new HashMap[String, String] + + try { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } def addPet (body: Pet) = { // create path and map variables val path = "/pet".replaceAll("\\{format\\}","json") @@ -246,26 +270,5 @@ class PetApi { case ex: ApiException => throw ex } } - def uploadFile (additionalMetadata: String, file: File) = { - // create path and map variables - val path = "/pet/uploadImage".replaceAll("\\{format\\}","json") - - val contentType = { - "application/json"} - - // query params - val queryParams = new HashMap[String, String] - val headerParams = new HashMap[String, String] - - try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, None, headerParams.toMap, contentType) match { - case s: String => - case _ => None - } - } catch { - case ex: ApiException if ex.code == 404 => None - case ex: ApiException => throw ex - } - } } diff --git a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala index c9d82ab2420..bfeece060ef 100644 --- a/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala +++ b/samples/client/petstore/scala/src/main/scala/com/wordnik/petstore/api/UserApi.scala @@ -15,9 +15,11 @@ class UserApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value - def createUser (body: User) = { + def updateUser (username: String, body: User) = { // create path and map variables - val path = "/user".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { if(body != null && body.isInstanceOf[File] ) @@ -30,12 +32,12 @@ class UserApi { val headerParams = new HashMap[String, String] // verify required params are set - (List(body).filter(_ != null)).size match { - case 1 => // all required values set + (List(username, body).filter(_ != null)).size match { + case 2 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -44,27 +46,26 @@ class UserApi { case ex: ApiException => throw ex } } - def createUsersWithArrayInput (body: List[User]) = { + def deleteUser (username: String) = { // create path and map variables - val path = "/user/createWithArray".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(body).filter(_ != null)).size match { + (List(username).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -73,71 +74,67 @@ class UserApi { case ex: ApiException => throw ex } } - def createUsersWithListInput (body: List[User]) = { + def getUserByName (username: String) : Option[User]= { // create path and map variables - val path = "/user/createWithList".replaceAll("\\{format\\}","json") + val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) + + val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(body).filter(_ != null)).size match { + (List(username).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def updateUser (username: String, body: User) = { + def loginUser (username: String, password: String) : Option[String]= { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user/login".replaceAll("\\{format\\}","json") val contentType = { - if(body != null && body.isInstanceOf[File] ) - "multipart/form-data" - else "application/json" - } + "application/json"} // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username, body).filter(_ != null)).size match { + (List(username, password).filter(_ != null)).size match { case 2 => // all required values set case _ => throw new Exception("missing required params") } + if(String.valueOf(username) != "null") queryParams += "username" -> username.toString + if(String.valueOf(password) != "null") queryParams += "password" -> password.toString try { - apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => - case _ => None + Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String]) + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def deleteUser (username: String) = { + def logoutUser () = { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user/logout".replaceAll("\\{format\\}","json") val contentType = { "application/json"} @@ -146,13 +143,8 @@ class UserApi { val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] - // verify required params are set - (List(username).filter(_ != null)).size match { - case 1 => // all required values set - case _ => throw new Exception("missing required params") - } try { - apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { case s: String => case _ => None } @@ -161,77 +153,85 @@ class UserApi { case ex: ApiException => throw ex } } - def getUserByName (username: String) : Option[User]= { + def createUser (body: User) = { // create path and map variables - val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) - - + val path = "/user".replaceAll("\\{format\\}","json") val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username).filter(_ != null)).size match { + (List(body).filter(_ != null)).size match { case 1 => // all required values set case _ => throw new Exception("missing required params") } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def loginUser (username: String, password: String) : Option[String]= { + def createUsersWithArrayInput (body: List[User]) = { // create path and map variables - val path = "/user/login".replaceAll("\\{format\\}","json") + val path = "/user/createWithArray".replaceAll("\\{format\\}","json") val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] // verify required params are set - (List(username, password).filter(_ != null)).size match { - case 2 => // all required values set + (List(body).filter(_ != null)).size match { + case 1 => // all required values set case _ => throw new Exception("missing required params") } - if(String.valueOf(username) != "null") queryParams += "username" -> username.toString - if(String.valueOf(password) != "null") queryParams += "password" -> password.toString try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => - Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String]) - case _ => None + case _ => None } } catch { case ex: ApiException if ex.code == 404 => None case ex: ApiException => throw ex } } - def logoutUser () = { + def createUsersWithListInput (body: List[User]) = { // create path and map variables - val path = "/user/logout".replaceAll("\\{format\\}","json") + val path = "/user/createWithList".replaceAll("\\{format\\}","json") val contentType = { - "application/json"} + if(body != null && body.isInstanceOf[File] ) + "multipart/form-data" + else "application/json" + } // query params val queryParams = new HashMap[String, String] val headerParams = new HashMap[String, String] + // verify required params are set + (List(body).filter(_ != null)).size match { + case 1 => // all required values set + case _ => throw new Exception("missing required params") + } try { - apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match { + apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match { case s: String => case _ => None }