forked from loafle/openapi-generator-original
add git_push and gitignore to most client generators
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Pet
|
||||
import io.swagger.client.model.Inline_response_200
|
||||
import java.io.File
|
||||
import io.swagger.client.ApiInvoker
|
||||
import io.swagger.client.ApiException
|
||||
@@ -23,53 +24,6 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
def updatePet (body: Pet) = {
|
||||
// create path and map variables
|
||||
val path = "/pet".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json", "application/xml", "application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = body
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
@@ -117,10 +71,108 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*
|
||||
* @param body Pet object in the form of byte array
|
||||
* @return void
|
||||
*/
|
||||
def addPetUsingByteArray (body: String) = {
|
||||
// create path and map variables
|
||||
val path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json", "application/xml", "application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = body
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
* @return void
|
||||
*/
|
||||
def deletePet (petId: Long, apiKey: String) = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for query
|
||||
* @return List[Pet]
|
||||
*/
|
||||
def findPetsByStatus (status: List[String] /* = available */) : Option[List[Pet]] = {
|
||||
@@ -265,6 +317,153 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return Inline_response_200
|
||||
*/
|
||||
def getPetByIdInObject (petId: Long) : Option[Inline_response_200] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[Inline_response_200]).asInstanceOf[Inline_response_200])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @return String
|
||||
*/
|
||||
def petPetIdtestingByteArraytrueGet (petId: Long) : Option[String] = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[String]).asInstanceOf[String])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
def updatePet (body: Pet) = {
|
||||
// create path and map variables
|
||||
val path = "/pet".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json", "application/xml", "application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = body
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
@@ -322,57 +521,6 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey
|
||||
* @return void
|
||||
*/
|
||||
def deletePet (petId: Long, apiKey: String) = {
|
||||
// create path and map variables
|
||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headerParams += "api_key" -> apiKey
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.swagger.client.api
|
||||
|
||||
import io.swagger.client.model.Order
|
||||
import io.swagger.client.model.Any
|
||||
import io.swagger.client.ApiInvoker
|
||||
import io.swagger.client.ApiException
|
||||
|
||||
@@ -22,6 +23,104 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
def deleteOrder (orderId: String) = {
|
||||
// create path and map variables
|
||||
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param status Status value that needs to be considered for query
|
||||
* @return List[Order]
|
||||
*/
|
||||
def findOrdersByStatus (status: String /* = placed */) : Option[List[Order]] = {
|
||||
// create path and map variables
|
||||
val path = "/store/findByStatus".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
if(String.valueOf(status) != "null") queryParams += "status" -> status.toString
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "array", classOf[Order]).asInstanceOf[List[Order]])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
@@ -70,14 +169,13 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
* Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
* Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
* @return Any
|
||||
*/
|
||||
def placeOrder (body: Order) : Option[Order] = {
|
||||
def getInventoryInObject () : Option[Any] = {
|
||||
// create path and map variables
|
||||
val path = "/store/order".replaceAll("\\{format\\}","json")
|
||||
val path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
@@ -93,7 +191,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = body
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
@@ -105,9 +203,9 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[Order]).asInstanceOf[Order])
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[Any]).asInstanceOf[Any])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
@@ -168,16 +266,14 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return void
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
*/
|
||||
def deleteOrder (orderId: String) = {
|
||||
def placeOrder (body: Order) : Option[Order] = {
|
||||
// create path and map variables
|
||||
val path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}",apiInvoker.escape(orderId))
|
||||
|
||||
|
||||
val path = "/store/order".replaceAll("\\{format\\}","json")
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
@@ -193,7 +289,7 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
var postBody: AnyRef = body
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
@@ -205,9 +301,10 @@ class StoreApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[Order]).asInstanceOf[Order])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -163,6 +163,105 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
def deleteUser (username: String) = {
|
||||
// create path and map variables
|
||||
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
def getUserByName (username: String) : Option[User] = {
|
||||
// create path and map variables
|
||||
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
@@ -260,56 +359,6 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
def getUserByName (username: String) : Option[User] = {
|
||||
// create path and map variables
|
||||
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User])
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -360,53 +409,4 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
def deleteUser (username: String) = {
|
||||
// create path and map variables
|
||||
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||
|
||||
|
||||
|
||||
val contentTypes = List("application/json")
|
||||
val contentType = contentTypes(0)
|
||||
|
||||
// query params
|
||||
val queryParams = new HashMap[String, String]
|
||||
val headerParams = new HashMap[String, String]
|
||||
val formParams = new HashMap[String, String]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var postBody: AnyRef = null
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
val mp = new FormDataMultiPart()
|
||||
|
||||
postBody = mp
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||
case s: String =>
|
||||
|
||||
case _ => None
|
||||
}
|
||||
} catch {
|
||||
case ex: ApiException if ex.code == 404 => None
|
||||
case ex: ApiException => throw ex
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user