regenerated client

This commit is contained in:
Tony Tam 2014-06-10 16:50:17 -07:00
parent cb5c2a9708
commit 0d6754e167
11 changed files with 136 additions and 119 deletions

View File

@ -1,5 +1,5 @@
/**
* Copyright 2012 Wordnik, Inc.
* Copyright 2014 Wordnik, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,10 +2,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>swagger-client</artifactId>
<artifactId>scala-client</artifactId>
<packaging>jar</packaging>
<name>swagger-client</name>
<version>1.0</version>
<name>scala-client</name>
<version>1.0.0</version>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
@ -170,13 +170,13 @@
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-core_2.9.1</artifactId>
<artifactId>swagger-core_${scala-short-version}</artifactId>
<version>${swagger-core-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.1</artifactId>
<artifactId>scalatest_${scala-short-version}</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
@ -187,15 +187,34 @@
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>scala_2.10</id>
<properties>
<scala-version>2.10.3</scala-version>
<scala-short-version>2.10</scala-short-version>
<swagger-core-version>1.3.2</swagger-core-version>
<scala-test-version>2.1.2</scala-test-version>
</properties>
</profile>
<profile>
<id>scala_2.9.1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<scala-version>2.9.1-1</scala-version>
<scala-short-version>2.9.1</scala-short-version>
<swagger-core-version>1.1.0</swagger-core-version>
<scala-test-version>1.6.1</scala-test-version>
</properties>
</profile>
</profiles>
<properties>
<jersey-version>1.7</jersey-version>
<swagger-core-version>1.1.0</swagger-core-version>
<scala-version>2.9.1-1</scala-version>
<junit-version>4.8.1</junit-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<scala-test-version>1.6.1</scala-test-version>
<junit-version>4.8.1</junit-version>
<scala-test-version>1.6.1</scala-test-version>
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
</properties>
</project>

View File

@ -44,8 +44,6 @@ object ApiInvoker {
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
}
def addHeader(key: String, value: String) = defaultHeaders += key -> value
def escape(value: Long): String = value.toString
def escape(value: Double): String = value.toString
def escape(value: Float): String = value.toString

View File

@ -1,6 +1,5 @@
package com.wordnik.petstore.api
import java.io.File
import com.wordnik.petstore.model.Pet
import com.wordnik.client.ApiInvoker
import com.wordnik.client.ApiException
@ -21,6 +20,7 @@ class PetApi {
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
val contentType = {
"application/json"}
@ -49,6 +49,7 @@ class PetApi {
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
val contentType = {
"application/json"}
@ -76,6 +77,7 @@ class PetApi {
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
val contentType = {
if(body != null && body.isInstanceOf[File] )
"multipart/form-data"
@ -107,6 +109,7 @@ class PetApi {
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
val contentType = {
"application/json"}
@ -132,6 +135,7 @@ class PetApi {
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"
@ -155,6 +159,7 @@ class PetApi {
def addPet (body: Pet) = {
// create path and map variables
val path = "/pet".replaceAll("\\{format\\}","json")
val contentType = {
if(body != null && body.isInstanceOf[File] )
"multipart/form-data"
@ -183,6 +188,7 @@ class PetApi {
def updatePet (body: Pet) = {
// create path and map variables
val path = "/pet".replaceAll("\\{format\\}","json")
val contentType = {
if(body != null && body.isInstanceOf[File] )
"multipart/form-data"
@ -211,6 +217,7 @@ class PetApi {
def findPetsByStatus (status: String= "available") : Option[List[Pet]]= {
// create path and map variables
val path = "/pet/findByStatus".replaceAll("\\{format\\}","json")
val contentType = {
"application/json"}
@ -238,6 +245,7 @@ class PetApi {
def findPetsByTags (tags: String) : Option[List[Pet]]= {
// create path and map variables
val path = "/pet/findByTags".replaceAll("\\{format\\}","json")
val contentType = {
"application/json"}

View File

@ -20,6 +20,7 @@ class StoreApi {
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
val contentType = {
"application/json"}
@ -48,6 +49,7 @@ class StoreApi {
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
val contentType = {
"application/json"}
@ -73,6 +75,7 @@ class StoreApi {
def placeOrder (body: Order) = {
// create path and map variables
val path = "/store/order".replaceAll("\\{format\\}","json")
val contentType = {
if(body != null && body.isInstanceOf[File] )
"multipart/form-data"

View File

@ -15,95 +15,12 @@ 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))
val contentType = {
if(body != null && body.isInstanceOf[File] )
"multipart/form-data"
@ -134,6 +51,7 @@ class UserApi {
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
val contentType = {
"application/json"}
@ -161,6 +79,7 @@ class UserApi {
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
val contentType = {
"application/json"}
@ -187,6 +106,7 @@ class UserApi {
def loginUser (username: String, password: String) : Option[String]= {
// create path and map variables
val path = "/user/login".replaceAll("\\{format\\}","json")
val contentType = {
"application/json"}
@ -215,6 +135,7 @@ class UserApi {
def logoutUser () = {
// create path and map variables
val path = "/user/logout".replaceAll("\\{format\\}","json")
val contentType = {
"application/json"}
@ -232,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
}
}
}

View File

@ -1,8 +1,6 @@
package com.wordnik.petstore.model
case class Category (
/* Category unique identifier */
id: Long,
/* Name of the category */
name: String)

View File

@ -2,14 +2,10 @@ package com.wordnik.petstore.model
import java.util.Date
case class Order (
/* Unique identifier for the order */
id: Long,
/* ID of pet being ordered */
petId: Long,
/* Number of pets ordered */
quantity: Int,
/* Status of the order */
/* Order Status */
status: String,
/* Date shipped, only if it has been */
shipDate: Date)

View File

@ -3,15 +3,11 @@ package com.wordnik.petstore.model
import com.wordnik.petstore.model.Category
import com.wordnik.petstore.model.Tag
case class Pet (
/* Unique identifier for the Pet */
/* unique identifier for the pet */
id: Long,
/* Category the pet is in */
category: Category,
/* Friendly name of the pet */
name: String,
/* Image URLs */
photoUrls: List[String],
/* Tags assigned to this pet */
tags: List[Tag],
/* pet status in the store */
status: String)

View File

@ -1,8 +1,6 @@
package com.wordnik.petstore.model
case class Tag (
/* Unique identifier for the tag */
id: Long,
/* Friendly name for the tag */
name: String)

View File

@ -1,19 +1,12 @@
package com.wordnik.petstore.model
case class User (
/* Unique identifier for the user */
id: Long,
/* Unique username */
username: String,
/* First name of the user */
firstName: String,
/* Last name of the user */
username: String,
lastName: String,
/* Email address of the user */
email: String,
/* Password name of the user */
password: String,
/* Phone number of the user */
phone: String,
/* User Status */
userStatus: Int)