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,34 +15,6 @@ 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)) @@ -72,6 +44,34 @@ 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,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,93 +15,6 @@ 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)) @@ -240,5 +153,92 @@ 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 + } + } }