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,6 +15,34 @@ class PetApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value + def deletePet (petId: String) = { + // create path and map variables + val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) + + + + val contentType = { + "application/json"} + + // query params + val queryParams = new HashMap[String, String] + val headerParams = new HashMap[String, String] + + // verify required params are set + (List(petId).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 { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } def getPetById (petId: Long) : Option[Pet]= { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -44,34 +72,6 @@ class PetApi { case ex: ApiException => throw ex } } - def deletePet (petId: String) = { - // create path and map variables - val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) - - - - val contentType = { - "application/json"} - - // query params - val queryParams = new HashMap[String, String] - val headerParams = new HashMap[String, String] - - // verify required params are set - (List(petId).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 { - case s: String => - case _ => None - } - } catch { - case ex: ApiException if ex.code == 404 => None - case ex: ApiException => throw ex - } - } def partialUpdate (petId: String, body: Pet) : Option[List[Pet]]= { // create path and map variables val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId)) @@ -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,6 +15,93 @@ class UserApi { def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value + def createUser (body: User) = { + // create path and map variables + val path = "/user".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] + + // 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 { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } + def createUsersWithArrayInput (body: List[User]) = { + // create path and map variables + val path = "/user/createWithArray".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] + + // 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 { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } + def createUsersWithListInput (body: List[User]) = { + // create path and map variables + val path = "/user/createWithList".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] + + // 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 { + case s: String => + case _ => None + } + } catch { + case ex: ApiException if ex.code == 404 => None + case ex: ApiException => throw ex + } + } def updateUser (username: String, body: User) = { // create path and map variables val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username)) @@ -153,92 +240,5 @@ class UserApi { case ex: ApiException => throw ex } } - def createUser (body: User) = { - // create path and map variables - val path = "/user".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] - - // 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 { - case s: String => - case _ => None - } - } catch { - case ex: ApiException if ex.code == 404 => None - case ex: ApiException => throw ex - } - } - def createUsersWithArrayInput (body: List[User]) = { - // create path and map variables - val path = "/user/createWithArray".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] - - // 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 { - case s: String => - case _ => None - } - } catch { - case ex: ApiException if ex.code == 404 => None - case ex: ApiException => throw ex - } - } - def createUsersWithListInput (body: List[User]) = { - // create path and map variables - val path = "/user/createWithList".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] - - // 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 { - 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/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