regenerated client

This commit is contained in:
Tony Tam 2013-10-18 14:44:02 -07:00
parent c4990b773d
commit 731fddbc30
45 changed files with 1235 additions and 468 deletions

View File

@ -26,7 +26,7 @@
/// </summary> /// </summary>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns></returns> /// <returns></returns>
public Pet getPetById (string petId) { public Pet getPetById (long petId) {
// create path and map variables // create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString())); var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
@ -92,6 +92,111 @@
} }
} }
/// <summary> /// <summary>
/// partial updates to a pet
/// </summary>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
public Array<Pet> partialUpdate (string petId, Pet body) {
// create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
// query params
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
// verify required params are set
if (petId == null || body == null ) {
throw new ApiException(400, "missing required params");
}
string paramStr = null;
try {
var response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams);
if(response != null){
return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.ErrorCode == 404) {
return null;
}
else {
throw ex;
}
}
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
public void updatePetWithForm (string petId, string name, string status) {
// create path and map variables
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
// query params
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
// verify required params are set
if (petId == null ) {
throw new ApiException(400, "missing required params");
}
string paramStr = null;
try {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.ErrorCode == 404) {
return ;
}
else {
throw ex;
}
}
}
/// <summary>
/// uploads an image
/// </summary>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="body">file to upload</param>
/// <returns></returns>
public void uploadFile (string additionalMetadata, File body) {
// create path and map variables
var path = "/pet/uploadImage".Replace("{format}","json");
// query params
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
string paramStr = null;
try {
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.ErrorCode == 404) {
return ;
}
else {
throw ex;
}
}
}
/// <summary>
/// Add a new pet to the store /// Add a new pet to the store
/// </summary> /// </summary>
/// <param name="body">Pet object that needs to be added to the store</param> /// <param name="body">Pet object that needs to be added to the store</param>
@ -166,7 +271,7 @@
/// </summary> /// </summary>
/// <param name="status">Status values that need to be considered for filter</param> /// <param name="status">Status values that need to be considered for filter</param>
/// <returns></returns> /// <returns></returns>
public List<Pet> findPetsByStatus (string status) { public Array<Pet> findPetsByStatus (string status) {
// create path and map variables // create path and map variables
var path = "/pet/findByStatus".Replace("{format}","json"); var path = "/pet/findByStatus".Replace("{format}","json");
@ -186,7 +291,7 @@
try { try {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
if(response != null){ if(response != null){
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>)); return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
} }
else { else {
return null; return null;
@ -205,7 +310,7 @@
/// </summary> /// </summary>
/// <param name="tags">Tags to filter by</param> /// <param name="tags">Tags to filter by</param>
/// <returns></returns> /// <returns></returns>
public List<Pet> findPetsByTags (string tags) { public Array<Pet> findPetsByTags (string tags) {
// create path and map variables // create path and map variables
var path = "/pet/findByTags".Replace("{format}","json"); var path = "/pet/findByTags".Replace("{format}","json");
@ -225,7 +330,7 @@
try { try {
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams); var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
if(response != null){ if(response != null){
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>)); return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
} }
else { else {
return null; return null;

View File

@ -61,7 +61,7 @@
/// </summary> /// </summary>
/// <param name="body">List of user object</param> /// <param name="body">List of user object</param>
/// <returns></returns> /// <returns></returns>
public void createUsersWithArrayInput (array<User> body) { public void createUsersWithArrayInput (List<User> body) {
// create path and map variables // create path and map variables
var path = "/user/createWithArray".Replace("{format}","json"); var path = "/user/createWithArray".Replace("{format}","json");
@ -96,7 +96,7 @@
/// </summary> /// </summary>
/// <param name="body">List of user object</param> /// <param name="body">List of user object</param>
/// <returns></returns> /// <returns></returns>
public void createUsersWithListInput (array<User> body) { public void createUsersWithListInput (List<User> body) {
// create path and map variables // create path and map variables
var path = "/user/createWithList".Replace("{format}","json"); var path = "/user/createWithList".Replace("{format}","json");

View File

@ -5,15 +5,17 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model { namespace Com.Wordnik.Petstore.Model {
public class Category { public class Category {
public string name { get; set; } /* Category unique identifier */
public long id { get; set; } public long id { get; set; }
/* Name of the category */
public string name { get; set; }
public override string ToString() { public override string ToString() {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("class Category {\n"); sb.Append("class Category {\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" id: ").Append(id).Append("\n"); sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append("}\n"); sb.Append("}\n");
return sb.ToString(); return sb.ToString();
} }

View File

@ -5,24 +5,28 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model { namespace Com.Wordnik.Petstore.Model {
public class Order { public class Order {
/* Unique identifier for the order */
public long id { get; set; } public long id { get; set; }
/* Order Status */ /* ID of pet being ordered */
public string status { get; set; }
public long petId { get; set; } public long petId { get; set; }
/* Number of pets ordered */
public int quantity { get; set; } public int quantity { get; set; }
/* Status of the order */
public string status { get; set; }
/* Date shipped, only if it has been */
public DateTime shipDate { get; set; } public DateTime shipDate { get; set; }
public override string ToString() { public override string ToString() {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("class Order {\n"); sb.Append("class Order {\n");
sb.Append(" id: ").Append(id).Append("\n"); sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" petId: ").Append(petId).Append("\n"); sb.Append(" petId: ").Append(petId).Append("\n");
sb.Append(" quantity: ").Append(quantity).Append("\n"); sb.Append(" quantity: ").Append(quantity).Append("\n");
sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" shipDate: ").Append(shipDate).Append("\n"); sb.Append(" shipDate: ").Append(shipDate).Append("\n");
sb.Append("}\n"); sb.Append("}\n");
return sb.ToString(); return sb.ToString();

View File

@ -5,28 +5,33 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model { namespace Com.Wordnik.Petstore.Model {
public class Pet { public class Pet {
public string name { get; set; } /* Unique identifier for the Pet */
public long id { get; set; } public long id { get; set; }
/* Category the pet is in */
public Category category { get; set; }
/* Friendly name of the pet */
public string name { get; set; }
/* Image URLs */
public List<string> photoUrls { get; set; }
/* Tags assigned to this pet */
public List<Tag> tags { get; set; } public List<Tag> tags { get; set; }
/* pet status in the store */ /* pet status in the store */
public string status { get; set; } public string status { get; set; }
public List<string> photoUrls { get; set; }
public Category category { get; set; }
public override string ToString() { public override string ToString() {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("class Pet {\n"); sb.Append("class Pet {\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" id: ").Append(id).Append("\n"); sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" category: ").Append(category).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" photoUrls: ").Append(photoUrls).Append("\n");
sb.Append(" tags: ").Append(tags).Append("\n"); sb.Append(" tags: ").Append(tags).Append("\n");
sb.Append(" status: ").Append(status).Append("\n"); sb.Append(" status: ").Append(status).Append("\n");
sb.Append(" photoUrls: ").Append(photoUrls).Append("\n");
sb.Append(" category: ").Append(category).Append("\n");
sb.Append("}\n"); sb.Append("}\n");
return sb.ToString(); return sb.ToString();
} }

View File

@ -5,15 +5,17 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model { namespace Com.Wordnik.Petstore.Model {
public class Tag { public class Tag {
public string name { get; set; } /* Unique identifier for the tag */
public long id { get; set; } public long id { get; set; }
/* Friendly name for the tag */
public string name { get; set; }
public override string ToString() { public override string ToString() {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("class Tag {\n"); sb.Append("class Tag {\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append(" id: ").Append(id).Append("\n"); sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" name: ").Append(name).Append("\n");
sb.Append("}\n"); sb.Append("}\n");
return sb.ToString(); return sb.ToString();
} }

View File

@ -5,18 +5,25 @@ using System.Collections.Generic;
namespace Com.Wordnik.Petstore.Model { namespace Com.Wordnik.Petstore.Model {
public class User { public class User {
/* Unique identifier for the user */
public long id { get; set; } public long id { get; set; }
public string firstName { get; set; } /* Unique username */
public string username { get; set; } public string username { get; set; }
/* First name of the user */
public string firstName { get; set; }
/* Last name of the user */
public string lastName { get; set; } public string lastName { get; set; }
/* Email address of the user */
public string email { get; set; } public string email { get; set; }
/* Password name of the user */
public string password { get; set; } public string password { get; set; }
/* Phone number of the user */
public string phone { get; set; } public string phone { get; set; }
/* User Status */ /* User Status */
@ -26,8 +33,8 @@ namespace Com.Wordnik.Petstore.Model {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("class User {\n"); sb.Append("class User {\n");
sb.Append(" id: ").Append(id).Append("\n"); sb.Append(" id: ").Append(id).Append("\n");
sb.Append(" firstName: ").Append(firstName).Append("\n");
sb.Append(" username: ").Append(username).Append("\n"); sb.Append(" username: ").Append(username).Append("\n");
sb.Append(" firstName: ").Append(firstName).Append("\n");
sb.Append(" lastName: ").Append(lastName).Append("\n"); sb.Append(" lastName: ").Append(lastName).Append("\n");
sb.Append(" email: ").Append(email).Append("\n"); sb.Append(" email: ").Append(email).Append("\n");
sb.Append(" password: ").Append(password).Append("\n"); sb.Append(" password: ").Append(password).Append("\n");

View File

@ -7,6 +7,7 @@ import com.wordnik.swagger.common.ApiUserCredentials;
import com.wordnik.swagger.event.Response; import com.wordnik.swagger.event.Response;
import com.wordnik.swagger.common.SwaggerApi; import com.wordnik.swagger.common.SwaggerApi;
import com.wordnik.client.model.Pet; import com.wordnik.client.model.Pet;
import com.wordnik.client.model.File;
import mx.rpc.AsyncToken; import mx.rpc.AsyncToken;
import mx.utils.UIDUtil; import mx.utils.UIDUtil;
import flash.utils.Dictionary; import flash.utils.Dictionary;
@ -23,15 +24,19 @@ public class PetApi extends SwaggerApi {
} }
public static const event_getPetById: String = "getPetById"; public static const event_getPetById: String = "getPetById";
public static const event_deletePet: String = "deletePet";
public static const event_partialUpdate: String = "partialUpdate";
public static const event_updatePetWithForm: String = "updatePetWithForm";
public static const event_uploadFile: String = "uploadFile";
public static const event_addPet: String = "addPet"; public static const event_addPet: String = "addPet";
public static const event_updatePet: String = "updatePet"; public static const event_updatePet: String = "updatePet";
public static const event_findPetsByStatus: String = "findPetsByStatus"; public static const event_findPetsByStatus: String = "findPetsByStatus";
public static const event_findPetsByTags: String = "findPetsByTags"; public static const event_findPetsByTags: String = "findPetsByTags";
/* /*
* Returns Pet */ * Returns Pet */
public function getPetById (petId: String): String { public function getPetById (petId: Number): String {
// create path and map variables // create path and map variables
var path: String = "/pet.{format}/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId)); var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -51,12 +56,108 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.returnType = Pet; token.returnType = Pet;
return requestId; return requestId;
}
/*
* Returns void */
public function deletePet (petId: String): String {
// create path and map variables
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if(petId == null ) {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "DELETE", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "deletePet";
token.returnType = null ;
return requestId;
}
/*
* Returns Array[Pet] */
public function partialUpdate (petId: String, body: Pet): String {
// create path and map variables
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if(petId == null || body == null ) {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "PATCH", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "partialUpdate";
token.returnType = Array[Pet];
return requestId;
}
/*
* Returns void */
public function updatePetWithForm (petId: String, name: String, status: String): String {
// create path and map variables
var path: String = "/pet/{petId}".replace(/{format}/g,"xml").replace("{" + "petId" + "}", getApiInvoker().escapeString(petId));
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if(petId == null ) {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, null, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "updatePetWithForm";
token.returnType = null ;
return requestId;
}
/*
* Returns void */
public function uploadFile (additionalMetadata: String, body: File): String {
// create path and map variables
var path: String = "/pet/uploadImage".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "uploadFile";
token.returnType = null ;
return requestId;
} }
/* /*
* Returns void */ * Returns void */
public function addPet (body: Pet): String { public function addPet (body: Pet): String {
// create path and map variables // create path and map variables
var path: String = "/pet.{format}".replace(/{format}/g,"xml"); var path: String = "/pet".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -81,7 +182,7 @@ public static const event_findPetsByTags: String = "findPetsByTags";
* Returns void */ * Returns void */
public function updatePet (body: Pet): String { public function updatePet (body: Pet): String {
// create path and map variables // create path and map variables
var path: String = "/pet.{format}".replace(/{format}/g,"xml"); var path: String = "/pet".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -103,10 +204,10 @@ public static const event_findPetsByTags: String = "findPetsByTags";
} }
/* /*
* Returns com.wordnik.client.model.PetList */ * Returns Array[Pet] */
public function findPetsByStatus (status: String= "available"): String { public function findPetsByStatus (status: String= "available"): String {
// create path and map variables // create path and map variables
var path: String = "/pet.{format}/findByStatus".replace(/{format}/g,"xml"); var path: String = "/pet/findByStatus".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -125,15 +226,15 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.requestId = requestId; token.requestId = requestId;
token.completionEventType = "findPetsByStatus"; token.completionEventType = "findPetsByStatus";
token.returnType = com.wordnik.client.model.PetList; token.returnType = Array[Pet];
return requestId; return requestId;
} }
/* /*
* Returns com.wordnik.client.model.PetList */ * Returns Array[Pet] */
public function findPetsByTags (tags: String): String { public function findPetsByTags (tags: String): String {
// create path and map variables // create path and map variables
var path: String = "/pet.{format}/findByTags".replace(/{format}/g,"xml"); var path: String = "/pet/findByTags".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -152,7 +253,7 @@ public static const event_findPetsByTags: String = "findPetsByTags";
token.requestId = requestId; token.requestId = requestId;
token.completionEventType = "findPetsByTags"; token.completionEventType = "findPetsByTags";
token.returnType = com.wordnik.client.model.PetList; token.returnType = Array[Pet];
return requestId; return requestId;
} }

View File

@ -29,7 +29,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns Order */ * Returns Order */
public function getOrderById (orderId: String): String { public function getOrderById (orderId: String): String {
// create path and map variables // create path and map variables
var path: String = "/store.{format}/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId)); var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -54,7 +54,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns void */ * Returns void */
public function deleteOrder (orderId: String): String { public function deleteOrder (orderId: String): String {
// create path and map variables // create path and map variables
var path: String = "/store.{format}/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId)); var path: String = "/store/order/{orderId}".replace(/{format}/g,"xml").replace("{" + "orderId" + "}", getApiInvoker().escapeString(orderId));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -79,7 +79,7 @@ public static const event_placeOrder: String = "placeOrder";
* Returns void */ * Returns void */
public function placeOrder (body: Order): String { public function placeOrder (body: Order): String {
// create path and map variables // create path and map variables
var path: String = "/store.{format}/order".replace(/{format}/g,"xml"); var path: String = "/store/order".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();

View File

@ -22,8 +22,8 @@ public class UserApi extends SwaggerApi {
super(apiCredentials, eventDispatcher); super(apiCredentials, eventDispatcher);
} }
public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
public static const event_createUser: String = "createUser"; public static const event_createUser: String = "createUser";
public static const event_createUsersWithArrayInput: String = "createUsersWithArrayInput";
public static const event_createUsersWithListInput: String = "createUsersWithListInput"; public static const event_createUsersWithListInput: String = "createUsersWithListInput";
public static const event_updateUser: String = "updateUser"; public static const event_updateUser: String = "updateUser";
public static const event_deleteUser: String = "deleteUser"; public static const event_deleteUser: String = "deleteUser";
@ -32,34 +32,9 @@ public static const event_loginUser: String = "loginUser";
public static const event_logoutUser: String = "logoutUser"; public static const event_logoutUser: String = "logoutUser";
/* /*
* Returns void */ * Returns void */
public function createUsersWithArrayInput (body: Array): String {
// create path and map variables
var path: String = "/user.{format}/createWithArray".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if(body == null ) {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "createUsersWithArrayInput";
token.returnType = null ;
return requestId;
}
/*
* Returns void */
public function createUser (body: User): String { public function createUser (body: User): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}".replace(/{format}/g,"xml"); var path: String = "/user".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -79,12 +54,37 @@ public static const event_logoutUser: String = "logoutUser";
token.returnType = null ; token.returnType = null ;
return requestId; return requestId;
}
/*
* Returns void */
public function createUsersWithArrayInput (body: Array): String {
// create path and map variables
var path: String = "/user/createWithArray".replace(/{format}/g,"xml");
// query params
var queryParams: Dictionary = new Dictionary();
var headerParams: Dictionary = new Dictionary();
// verify required params are set
if(body == null ) {
throw new ApiError(400, "missing required params");
}
var token:AsyncToken = getApiInvoker().invokeAPI(path, "POST", queryParams, body, headerParams);
var requestId: String = getUniqueId();
token.requestId = requestId;
token.completionEventType = "createUsersWithArrayInput";
token.returnType = null ;
return requestId;
} }
/* /*
* Returns void */ * Returns void */
public function createUsersWithListInput (body: Array): String { public function createUsersWithListInput (body: Array): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/createWithList".replace(/{format}/g,"xml"); var path: String = "/user/createWithList".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -109,7 +109,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */ * Returns void */
public function updateUser (username: String, body: User): String { public function updateUser (username: String, body: User): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -134,7 +134,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */ * Returns void */
public function deleteUser (username: String): String { public function deleteUser (username: String): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -159,7 +159,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns User */ * Returns User */
public function getUserByName (username: String): String { public function getUserByName (username: String): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username)); var path: String = "/user/{username}".replace(/{format}/g,"xml").replace("{" + "username" + "}", getApiInvoker().escapeString(username));
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -184,7 +184,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns string */ * Returns string */
public function loginUser (username: String, password: String): String { public function loginUser (username: String, password: String): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/login".replace(/{format}/g,"xml"); var path: String = "/user/login".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();
@ -213,7 +213,7 @@ public static const event_logoutUser: String = "logoutUser";
* Returns void */ * Returns void */
public function logoutUser (): String { public function logoutUser (): String {
// create path and map variables // create path and map variables
var path: String = "/user.{format}/logout".replace(/{format}/g,"xml"); var path: String = "/user/logout".replace(/{format}/g,"xml");
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();

View File

@ -2,9 +2,11 @@ package com.wordnik.client.model {
[XmlRootNode(name="Category")] [XmlRootNode(name="Category")]
public class Category { public class Category {
/* Category unique identifier */
[XmlElement(name="id")] [XmlElement(name="id")]
public var id: Number = 0.0; public var id: Number = 0.0;
/* Name of the category */
[XmlElement(name="name")] [XmlElement(name="name")]
public var name: String = null; public var name: String = null;

View File

@ -2,19 +2,23 @@ package com.wordnik.client.model {
[XmlRootNode(name="Order")] [XmlRootNode(name="Order")]
public class Order { public class Order {
/* Unique identifier for the order */
[XmlElement(name="id")] [XmlElement(name="id")]
public var id: Number = 0.0; public var id: Number = 0.0;
/* ID of pet being ordered */
[XmlElement(name="petId")] [XmlElement(name="petId")]
public var petId: Number = 0.0; public var petId: Number = 0.0;
/* Order Status */ /* Number of pets ordered */
[XmlElement(name="status")]
public var status: String = null;
[XmlElement(name="quantity")] [XmlElement(name="quantity")]
public var quantity: Number = 0.0; public var quantity: Number = 0.0;
/* Status of the order */
[XmlElement(name="status")]
public var status: String = null;
/* Date shipped, only if it has been */
[XmlElement(name="shipDate")] [XmlElement(name="shipDate")]
public var shipDate: Date = null; public var shipDate: Date = null;
@ -22,8 +26,8 @@ package com.wordnik.client.model {
var str: String = "Order: "; var str: String = "Order: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (petId: " + petId + ")"; str += " (petId: " + petId + ")";
str += " (status: " + status + ")";
str += " (quantity: " + quantity + ")"; str += " (quantity: " + quantity + ")";
str += " (status: " + status + ")";
str += " (shipDate: " + shipDate + ")"; str += " (shipDate: " + shipDate + ")";
return str; return str;
} }

View File

@ -4,39 +4,44 @@ import com.wordnik.client.model.Category;
import com.wordnik.client.model.Tag; import com.wordnik.client.model.Tag;
[XmlRootNode(name="Pet")] [XmlRootNode(name="Pet")]
public class Pet { public class Pet {
// This declaration below of _tags_obj_class is to force flash compiler to include this class /* Unique identifier for the Pet */
private var _tags_obj_class: com.wordnik.client.model.Tag = null;
[XmlElementWrapper(name="tags")]
[XmlElements(name="tag", type="com.wordnik.client.model.Tag")]
public var tags: Array = new Array();
[XmlElement(name="id")] [XmlElement(name="id")]
public var id: Number = 0.0; public var id: Number = 0.0;
/* Category the pet is in */
[XmlElement(name="category")] [XmlElement(name="category")]
public var category: Category = null; public var category: Category = null;
/* pet status in the store */ /* Friendly name of the pet */
[XmlElement(name="status")]
public var status: String = null;
[XmlElement(name="name")] [XmlElement(name="name")]
public var name: String = null; public var name: String = null;
/* Image URLs */
// This declaration below of _photoUrls_obj_class is to force flash compiler to include this class // This declaration below of _photoUrls_obj_class is to force flash compiler to include this class
private var _photoUrls_obj_class: com.wordnik.client.model.String = null; private var _photoUrls_obj_class: com.wordnik.client.model.String = null;
[XmlElementWrapper(name="photoUrls")] [XmlElementWrapper(name="photoUrls")]
[XmlElements(name="photoUrl", type="com.wordnik.client.model.String")] [XmlElements(name="photoUrl", type="com.wordnik.client.model.String")]
public var photoUrls: Array = new Array(); public var photoUrls: Array = new Array();
/* Tags assigned to this pet */
// This declaration below of _tags_obj_class is to force flash compiler to include this class
private var _tags_obj_class: com.wordnik.client.model.Tag = null;
[XmlElementWrapper(name="tags")]
[XmlElements(name="tag", type="com.wordnik.client.model.Tag")]
public var tags: Array = new Array();
/* pet status in the store */
[XmlElement(name="status")]
public var status: String = null;
public function toString(): String { public function toString(): String {
var str: String = "Pet: "; var str: String = "Pet: ";
str += " (tags: " + tags + ")";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (category: " + category + ")"; str += " (category: " + category + ")";
str += " (status: " + status + ")";
str += " (name: " + name + ")"; str += " (name: " + name + ")";
str += " (photoUrls: " + photoUrls + ")"; str += " (photoUrls: " + photoUrls + ")";
str += " (tags: " + tags + ")";
str += " (status: " + status + ")";
return str; return str;
} }

View File

@ -2,9 +2,11 @@ package com.wordnik.client.model {
[XmlRootNode(name="Tag")] [XmlRootNode(name="Tag")]
public class Tag { public class Tag {
/* Unique identifier for the tag */
[XmlElement(name="id")] [XmlElement(name="id")]
public var id: Number = 0.0; public var id: Number = 0.0;
/* Friendly name for the tag */
[XmlElement(name="name")] [XmlElement(name="name")]
public var name: String = null; public var name: String = null;

View File

@ -2,41 +2,48 @@ package com.wordnik.client.model {
[XmlRootNode(name="User")] [XmlRootNode(name="User")]
public class User { public class User {
/* Unique identifier for the user */
[XmlElement(name="id")] [XmlElement(name="id")]
public var id: Number = 0.0; public var id: Number = 0.0;
[XmlElement(name="lastName")] /* Unique username */
public var lastName: String = null;
[XmlElement(name="phone")]
public var phone: String = null;
[XmlElement(name="username")] [XmlElement(name="username")]
public var username: String = null; public var username: String = null;
/* First name of the user */
[XmlElement(name="firstName")]
public var firstName: String = null;
/* Last name of the user */
[XmlElement(name="lastName")]
public var lastName: String = null;
/* Email address of the user */
[XmlElement(name="email")] [XmlElement(name="email")]
public var email: String = null; public var email: String = null;
/* Password name of the user */
[XmlElement(name="password")]
public var password: String = null;
/* Phone number of the user */
[XmlElement(name="phone")]
public var phone: String = null;
/* User Status */ /* User Status */
[XmlElement(name="userStatus")] [XmlElement(name="userStatus")]
public var userStatus: Number = 0.0; public var userStatus: Number = 0.0;
[XmlElement(name="firstName")]
public var firstName: String = null;
[XmlElement(name="password")]
public var password: String = null;
public function toString(): String { public function toString(): String {
var str: String = "User: "; var str: String = "User: ";
str += " (id: " + id + ")"; str += " (id: " + id + ")";
str += " (lastName: " + lastName + ")";
str += " (phone: " + phone + ")";
str += " (username: " + username + ")"; str += " (username: " + username + ")";
str += " (email: " + email + ")";
str += " (userStatus: " + userStatus + ")";
str += " (firstName: " + firstName + ")"; str += " (firstName: " + firstName + ")";
str += " (lastName: " + lastName + ")";
str += " (email: " + email + ")";
str += " (password: " + password + ")"; str += " (password: " + password + ")";
str += " (phone: " + phone + ")";
str += " (userStatus: " + userStatus + ")";
return str; return str;
} }

View File

@ -28,14 +28,14 @@ class PetApi {
/** /**
* getPetById * getPetById
* Find pet by ID * Find pet by ID
* petId, string: ID of pet that needs to be fetched (required) * petId, int: ID of pet that needs to be fetched (required)
* @return Pet * @return Pet
*/ */
public function getPetById($petId) { public function getPetById($petId) {
//parse inputs //parse inputs
$resourcePath = "/pet.{format}/{petId}"; $resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
@ -43,7 +43,7 @@ class PetApi {
if($petId != null) { if($petId != null) {
$resourcePath = str_replace("{" . "petId" . "}", $resourcePath = str_replace("{" . "petId" . "}",
$petId, $resourcePath); $this->apiClient->toPathValue($petId), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -62,6 +62,134 @@ class PetApi {
'Pet'); 'Pet');
return $responseObject; return $responseObject;
}
/**
* deletePet
* Deletes a pet
* petId, string: Pet id to delete (required)
* @return
*/
public function deletePet($petId) {
//parse inputs
$resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
$headerParams = array();
if($petId != null) {
$resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* partialUpdate
* partial updates to a pet
* petId, string: ID of pet that needs to be fetched (required)
* body, Pet: Pet object that needs to be added to the store (required)
* @return Array[Pet]
*/
public function partialUpdate($petId, $body) {
//parse inputs
$resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PATCH";
$queryParams = array();
$headerParams = array();
if($petId != null) {
$resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'Array[Pet]');
return $responseObject;
}
/**
* updatePetWithForm
* Updates a pet in the store with form data
* petId, string: ID of pet that needs to be updated (required)
* name, string: Updated name of the pet (optional)
* status, string: Updated status of the pet (optional)
* @return
*/
public function updatePetWithForm($petId, $name=null, $status=null) {
//parse inputs
$resourcePath = "/pet/{petId}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
if($petId != null) {
$resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* uploadFile
* uploads an image
* additionalMetadata, string: Additional data to pass to server (optional)
* body, File: file to upload (optional)
* @return
*/
public function uploadFile($additionalMetadata=null, $body=null) {
//parse inputs
$resourcePath = "/pet/uploadImage";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
} }
/** /**
* addPet * addPet
@ -73,7 +201,7 @@ class PetApi {
public function addPet($body) { public function addPet($body) {
//parse inputs //parse inputs
$resourcePath = "/pet.{format}"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$queryParams = array(); $queryParams = array();
@ -99,7 +227,7 @@ class PetApi {
public function updatePet($body) { public function updatePet($body) {
//parse inputs //parse inputs
$resourcePath = "/pet.{format}"; $resourcePath = "/pet";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$queryParams = array(); $queryParams = array();
@ -119,20 +247,20 @@ class PetApi {
* findPetsByStatus * findPetsByStatus
* Finds Pets by status * Finds Pets by status
* status, string: Status values that need to be considered for filter (required) * status, string: Status values that need to be considered for filter (required)
* @return array[Pet] * @return Array[Pet]
*/ */
public function findPetsByStatus($status) { public function findPetsByStatus($status) {
//parse inputs //parse inputs
$resourcePath = "/pet.{format}/findByStatus"; $resourcePath = "/pet/findByStatus";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
if($status != null) { if($status != null) {
$queryParams['status'] = $this->apiClient->toPathValue($status); $queryParams['status'] = $this->apiClient->toQueryValue($status);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -148,7 +276,7 @@ class PetApi {
} }
$responseObject = $this->apiClient->deserialize($response, $responseObject = $this->apiClient->deserialize($response,
'array[Pet]'); 'Array[Pet]');
return $responseObject; return $responseObject;
} }
@ -156,20 +284,20 @@ class PetApi {
* findPetsByTags * findPetsByTags
* Finds Pets by tags * Finds Pets by tags
* tags, string: Tags to filter by (required) * tags, string: Tags to filter by (required)
* @return array[Pet] * @return Array[Pet]
*/ */
public function findPetsByTags($tags) { public function findPetsByTags($tags) {
//parse inputs //parse inputs
$resourcePath = "/pet.{format}/findByTags"; $resourcePath = "/pet/findByTags";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
if($tags != null) { if($tags != null) {
$queryParams['tags'] = $this->apiClient->toPathValue($tags); $queryParams['tags'] = $this->apiClient->toQueryValue($tags);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -185,7 +313,7 @@ class PetApi {
} }
$responseObject = $this->apiClient->deserialize($response, $responseObject = $this->apiClient->deserialize($response,
'array[Pet]'); 'Array[Pet]');
return $responseObject; return $responseObject;
} }

View File

@ -35,7 +35,7 @@ class StoreApi {
public function getOrderById($orderId) { public function getOrderById($orderId) {
//parse inputs //parse inputs
$resourcePath = "/store.{format}/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
@ -43,7 +43,7 @@ class StoreApi {
if($orderId != null) { if($orderId != null) {
$resourcePath = str_replace("{" . "orderId" . "}", $resourcePath = str_replace("{" . "orderId" . "}",
$orderId, $resourcePath); $this->apiClient->toPathValue($orderId), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -73,7 +73,7 @@ class StoreApi {
public function deleteOrder($orderId) { public function deleteOrder($orderId) {
//parse inputs //parse inputs
$resourcePath = "/store.{format}/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$queryParams = array(); $queryParams = array();
@ -81,7 +81,7 @@ class StoreApi {
if($orderId != null) { if($orderId != null) {
$resourcePath = str_replace("{" . "orderId" . "}", $resourcePath = str_replace("{" . "orderId" . "}",
$orderId, $resourcePath); $this->apiClient->toPathValue($orderId), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -103,7 +103,7 @@ class StoreApi {
public function placeOrder($body) { public function placeOrder($body) {
//parse inputs //parse inputs
$resourcePath = "/store.{format}/order"; $resourcePath = "/store/order";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$queryParams = array(); $queryParams = array();

View File

@ -67,7 +67,7 @@ class APIClient {
} }
if (is_object($postData) or is_array($postData)) { if (is_object($postData) or is_array($postData)) {
$postData = json_encode($postData); $postData = json_encode(self::sanitizeForSerialization($postData));
} }
$url = $this->apiServer . $resourcePath; $url = $this->apiServer . $resourcePath;
@ -118,18 +118,41 @@ class APIClient {
$response_info['http_code']); $response_info['http_code']);
} }
return $data; return $data;
} }
/**
* Build a JSON POST object
*/
public static function sanitizeForSerialization($postData) {
foreach ($postData as $key => $value) {
if (is_a($value, "DateTime")) {
$postData->{$key} = $value->format(DateTime::ISO8601);
}
}
return $postData;
}
/** /**
* Take value and turn it into a string suitable for inclusion in * Take value and turn it into a string suitable for inclusion in
* the path or the header * the path, by url-encoding.
* @param string $value a string which will be part of the path
* @return string the serialized object
*/
public static function toPathValue($value) {
return rawurlencode($value);
}
/**
* Take value and turn it into a string suitable for inclusion in
* the query, by imploding comma-separated if it's an object.
* If it's a string, pass through unchanged. It will be url-encoded
* later.
* @param object $object an object to be serialized to a string * @param object $object an object to be serialized to a string
* @return string the serialized object * @return string the serialized object
*/ */
public static function toPathValue($object) { public static function toQueryValue($object) {
if (is_array($object)) { if (is_array($object)) {
return implode(',', $object); return implode(',', $object);
} else { } else {
@ -137,9 +160,18 @@ class APIClient {
} }
} }
/**
* Just pass through the header value for now. Placeholder in case we
* find out we need to do something with header values.
* @param string $value a string which will be part of the header
* @return string the header string
*/
public static function toHeaderValue($value) {
return $value;
}
/** /**
* Derialize a JSON string into an object * Deserialize a JSON string into an object
* *
* @param object $object object or primitive to be deserialized * @param object $object object or primitive to be deserialized
* @param string $class class name is passed as a string * @param string $class class name is passed as a string
@ -177,17 +209,14 @@ class APIClient {
if (! property_exists($class, $true_property)) { if (! property_exists($class, $true_property)) {
if (substr($property, -1) == 's') { if (substr($property, -1) == 's') {
$true_property = substr($property, 0, -1); $true_property = substr($property, 0, -1);
if (! property_exists($class, $true_property)) {
trigger_error("class $class has no property $property"
. " or $true_property", E_USER_WARNING);
}
} else {
trigger_error("class $class has no property $property",
E_USER_WARNING);
} }
} }
if (array_key_exists($true_property, $classVars['swaggerTypes'])) {
$type = $classVars['swaggerTypes'][$true_property]; $type = $classVars['swaggerTypes'][$true_property];
} else {
$type = 'string';
}
if (in_array($type, array('string', 'int', 'float', 'bool'))) { if (in_array($type, array('string', 'int', 'float', 'bool'))) {
settype($value, $type); settype($value, $type);
$instance->{$true_property} = $value; $instance->{$true_property} = $value;
@ -209,3 +238,5 @@ class APIClient {
?> ?>

View File

@ -26,16 +26,16 @@ class UserApi {
} }
/** /**
* createUsersWithArrayInput * createUser
* Creates list of users with given input array * Create user
* body, array[User]: List of user object (required) * body, User: Created user object (required)
* @return * @return
*/ */
public function createUsersWithArrayInput($body) { public function createUser($body) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/createWithArray"; $resourcePath = "/user";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$queryParams = array(); $queryParams = array();
@ -52,16 +52,16 @@ class UserApi {
} }
/** /**
* createUser * createUsersWithArrayInput
* Create user * Creates list of users with given input array
* body, User: Created user object (required) * body, array[User]: List of user object (required)
* @return * @return
*/ */
public function createUser($body) { public function createUsersWithArrayInput($body) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}"; $resourcePath = "/user/createWithArray";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$queryParams = array(); $queryParams = array();
@ -80,14 +80,14 @@ class UserApi {
/** /**
* createUsersWithListInput * createUsersWithListInput
* Creates list of users with given list input * Creates list of users with given list input
* body, List[User]: List of user object (required) * body, array[User]: List of user object (required)
* @return * @return
*/ */
public function createUsersWithListInput($body) { public function createUsersWithListInput($body) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/createWithList"; $resourcePath = "/user/createWithList";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST"; $method = "POST";
$queryParams = array(); $queryParams = array();
@ -114,7 +114,7 @@ class UserApi {
public function updateUser($username, $body) { public function updateUser($username, $body) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT"; $method = "PUT";
$queryParams = array(); $queryParams = array();
@ -122,7 +122,7 @@ class UserApi {
if($username != null) { if($username != null) {
$resourcePath = str_replace("{" . "username" . "}", $resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath); $this->apiClient->toPathValue($username), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -144,7 +144,7 @@ class UserApi {
public function deleteUser($username) { public function deleteUser($username) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE"; $method = "DELETE";
$queryParams = array(); $queryParams = array();
@ -152,7 +152,7 @@ class UserApi {
if($username != null) { if($username != null) {
$resourcePath = str_replace("{" . "username" . "}", $resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath); $this->apiClient->toPathValue($username), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -174,7 +174,7 @@ class UserApi {
public function getUserByName($username) { public function getUserByName($username) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/{username}"; $resourcePath = "/user/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
@ -182,7 +182,7 @@ class UserApi {
if($username != null) { if($username != null) {
$resourcePath = str_replace("{" . "username" . "}", $resourcePath = str_replace("{" . "username" . "}",
$username, $resourcePath); $this->apiClient->toPathValue($username), $resourcePath);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -213,17 +213,17 @@ class UserApi {
public function loginUser($username, $password) { public function loginUser($username, $password) {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/login"; $resourcePath = "/user/login";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();
$headerParams = array(); $headerParams = array();
if($username != null) { if($username != null) {
$queryParams['username'] = $this->apiClient->toPathValue($username); $queryParams['username'] = $this->apiClient->toQueryValue($username);
} }
if($password != null) { if($password != null) {
$queryParams['password'] = $this->apiClient->toPathValue($password); $queryParams['password'] = $this->apiClient->toQueryValue($password);
} }
//make the API Call //make the API Call
if (! isset($body)) { if (! isset($body)) {
@ -252,7 +252,7 @@ class UserApi {
public function logoutUser() { public function logoutUser() {
//parse inputs //parse inputs
$resourcePath = "/user.{format}/logout"; $resourcePath = "/user/logout";
$resourcePath = str_replace("{format}", "json", $resourcePath); $resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET"; $method = "GET";
$queryParams = array(); $queryParams = array();

View File

@ -29,7 +29,13 @@ class Category {
); );
/**
* Category unique identifier
*/
public $id; // int public $id; // int
/**
* Name of the category
*/
public $name; // string public $name; // string
} }

View File

@ -26,19 +26,31 @@ class Order {
static $swaggerTypes = array( static $swaggerTypes = array(
'id' => 'int', 'id' => 'int',
'petId' => 'int', 'petId' => 'int',
'status' => 'string',
'quantity' => 'int', 'quantity' => 'int',
'status' => 'string',
'shipDate' => 'DateTime' 'shipDate' => 'DateTime'
); );
/**
* Unique identifier for the order
*/
public $id; // int public $id; // int
/**
* ID of pet being ordered
*/
public $petId; // int public $petId; // int
/** /**
* Order Status * Number of pets ordered
*/
public $quantity; // int
/**
* Status of the order
*/ */
public $status; // string public $status; // string
public $quantity; // int /**
* Date shipped, only if it has been
*/
public $shipDate; // DateTime public $shipDate; // DateTime
} }

View File

@ -24,23 +24,38 @@
class Pet { class Pet {
static $swaggerTypes = array( static $swaggerTypes = array(
'tags' => 'array[Some(Tag)]',
'id' => 'int', 'id' => 'int',
'category' => 'Category', 'category' => 'Category',
'status' => 'string',
'name' => 'string', 'name' => 'string',
'photoUrls' => 'array[None]' 'photoUrls' => 'array[string]',
'tags' => 'array[Tag]',
'status' => 'string'
); );
public $tags; // array[Some(Tag)] /**
* Unique identifier for the Pet
*/
public $id; // int public $id; // int
/**
* Category the pet is in
*/
public $category; // Category public $category; // Category
/** /**
* Friendly name of the pet
*/
public $name; // string
/**
* Image URLs
*/
public $photoUrls; // array[string]
/**
* Tags assigned to this pet
*/
public $tags; // array[Tag]
/**
* pet status in the store * pet status in the store
*/ */
public $status; // string public $status; // string
public $name; // string
public $photoUrls; // array[None]
} }

View File

@ -29,7 +29,13 @@ class Tag {
); );
/**
* Unique identifier for the tag
*/
public $id; // int public $id; // int
/**
* Friendly name for the tag
*/
public $name; // string public $name; // string
} }

View File

@ -25,26 +25,47 @@ class User {
static $swaggerTypes = array( static $swaggerTypes = array(
'id' => 'int', 'id' => 'int',
'lastName' => 'string',
'phone' => 'string',
'username' => 'string', 'username' => 'string',
'email' => 'string',
'userStatus' => 'int',
'firstName' => 'string', 'firstName' => 'string',
'password' => 'string' 'lastName' => 'string',
'email' => 'string',
'password' => 'string',
'phone' => 'string',
'userStatus' => 'int'
); );
/**
* Unique identifier for the user
*/
public $id; // int public $id; // int
public $lastName; // string /**
public $phone; // string * Unique username
*/
public $username; // string public $username; // string
/**
* First name of the user
*/
public $firstName; // string
/**
* Last name of the user
*/
public $lastName; // string
/**
* Email address of the user
*/
public $email; // string public $email; // string
/** /**
* Password name of the user
*/
public $password; // string
/**
* Phone number of the user
*/
public $phone; // string
/**
* User Status * User Status
*/ */
public $userStatus; // int public $userStatus; // int
public $firstName; // string
public $password; // string
} }

View File

@ -33,7 +33,7 @@ class PetApi(object):
"""Find pet by ID """Find pet by ID
Args: Args:
petId, str: ID of pet that needs to be fetched (required) petId, long: ID of pet that needs to be fetched (required)
Returns: Pet Returns: Pet
""" """
@ -47,7 +47,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/pet.{format}/{petId}' resourcePath = '/pet/{petId}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -70,6 +70,155 @@ class PetApi(object):
return responseObject return responseObject
def deletePet(self, petId, **kwargs):
"""Deletes a pet
Args:
petId, str: Pet id to delete (required)
Returns:
"""
allParams = ['petId']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method deletePet" % key)
params[key] = val
del params['kwargs']
resourcePath = '/pet/{petId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'DELETE'
queryParams = {}
headerParams = {}
if ('petId' in params):
replacement = str(self.apiClient.toPathValue(params['petId']))
resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement)
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
def partialUpdate(self, petId, body, **kwargs):
"""partial updates to a pet
Args:
petId, str: ID of pet that needs to be fetched (required)
body, Pet: Pet object that needs to be added to the store (required)
Returns: Array[Pet]
"""
allParams = ['petId', 'body']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method partialUpdate" % key)
params[key] = val
del params['kwargs']
resourcePath = '/pet/{petId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'PATCH'
queryParams = {}
headerParams = {}
if ('petId' in params):
replacement = str(self.apiClient.toPathValue(params['petId']))
resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement)
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
if not response:
return None
responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
return responseObject
def updatePetWithForm(self, petId, **kwargs):
"""Updates a pet in the store with form data
Args:
petId, str: ID of pet that needs to be updated (required)
name, str: Updated name of the pet (optional)
status, str: Updated status of the pet (optional)
Returns:
"""
allParams = ['petId', 'name', 'status']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method updatePetWithForm" % key)
params[key] = val
del params['kwargs']
resourcePath = '/pet/{petId}'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
queryParams = {}
headerParams = {}
if ('petId' in params):
replacement = str(self.apiClient.toPathValue(params['petId']))
resourcePath = resourcePath.replace('{' + 'petId' + '}',
replacement)
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
def uploadFile(self, **kwargs):
"""uploads an image
Args:
additionalMetadata, str: Additional data to pass to server (optional)
body, File: file to upload (optional)
Returns:
"""
allParams = ['additionalMetadata', 'body']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method uploadFile" % key)
params[key] = val
del params['kwargs']
resourcePath = '/pet/uploadImage'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
queryParams = {}
headerParams = {}
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
def addPet(self, body, **kwargs): def addPet(self, body, **kwargs):
"""Add a new pet to the store """Add a new pet to the store
@ -88,7 +237,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/pet.{format}' resourcePath = '/pet'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -120,7 +269,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/pet.{format}' resourcePath = '/pet'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'PUT' method = 'PUT'
@ -140,7 +289,7 @@ class PetApi(object):
Args: Args:
status, str: Status values that need to be considered for filter (required) status, str: Status values that need to be considered for filter (required)
Returns: list[Pet] Returns: Array[Pet]
""" """
allParams = ['status'] allParams = ['status']
@ -152,7 +301,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/pet.{format}/findByStatus' resourcePath = '/pet/findByStatus'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -169,7 +318,7 @@ class PetApi(object):
if not response: if not response:
return None return None
responseObject = self.apiClient.deserialize(response, 'list[Pet]') responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
return responseObject return responseObject
@ -179,7 +328,7 @@ class PetApi(object):
Args: Args:
tags, str: Tags to filter by (required) tags, str: Tags to filter by (required)
Returns: list[Pet] Returns: Array[Pet]
""" """
allParams = ['tags'] allParams = ['tags']
@ -191,7 +340,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/pet.{format}/findByTags' resourcePath = '/pet/findByTags'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -208,7 +357,7 @@ class PetApi(object):
if not response: if not response:
return None return None
responseObject = self.apiClient.deserialize(response, 'list[Pet]') responseObject = self.apiClient.deserialize(response, 'Array[Pet]')
return responseObject return responseObject

View File

@ -47,7 +47,7 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/store.{format}/order/{orderId}' resourcePath = '/store/order/{orderId}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -88,7 +88,7 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/store.{format}/order/{orderId}' resourcePath = '/store/order/{orderId}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'DELETE' method = 'DELETE'
@ -124,7 +124,7 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/store.{format}/order' resourcePath = '/store/order'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST' method = 'POST'

View File

@ -29,38 +29,6 @@ class UserApi(object):
self.apiClient = apiClient self.apiClient = apiClient
def createUsersWithArrayInput(self, body, **kwargs):
"""Creates list of users with given input array
Args:
body, list[User]: List of user object (required)
Returns:
"""
allParams = ['body']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
params[key] = val
del params['kwargs']
resourcePath = '/user.{format}/createWithArray'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
queryParams = {}
headerParams = {}
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
def createUser(self, body, **kwargs): def createUser(self, body, **kwargs):
"""Create user """Create user
@ -79,7 +47,39 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}' resourcePath = '/user'
resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST'
queryParams = {}
headerParams = {}
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
def createUsersWithArrayInput(self, body, **kwargs):
"""Creates list of users with given input array
Args:
body, list[User]: List of user object (required)
Returns:
"""
allParams = ['body']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method createUsersWithArrayInput" % key)
params[key] = val
del params['kwargs']
resourcePath = '/user/createWithArray'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -97,7 +97,7 @@ class UserApi(object):
"""Creates list of users with given list input """Creates list of users with given list input
Args: Args:
body, List[User]: List of user object (required) body, list[User]: List of user object (required)
Returns: Returns:
""" """
@ -111,7 +111,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/createWithList' resourcePath = '/user/createWithList'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -144,7 +144,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/{username}' resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'PUT' method = 'PUT'
@ -180,7 +180,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/{username}' resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'DELETE' method = 'DELETE'
@ -216,7 +216,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/{username}' resourcePath = '/user/{username}'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -258,7 +258,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/login' resourcePath = '/user/login'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -298,7 +298,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resourcePath = '/user.{format}/logout' resourcePath = '/user/logout'
resourcePath = resourcePath.replace('{format}', 'json') resourcePath = resourcePath.replace('{format}', 'json')
method = 'GET' method = 'GET'

View File

@ -27,6 +27,8 @@ class Category:
} }
#Category unique identifier
self.id = None # long self.id = None # long
#Name of the category
self.name = None # str self.name = None # str

View File

@ -23,17 +23,21 @@ class Order:
self.swaggerTypes = { self.swaggerTypes = {
'id': 'long', 'id': 'long',
'petId': 'long', 'petId': 'long',
'status': 'str',
'quantity': 'int', 'quantity': 'int',
'status': 'str',
'shipDate': 'datetime' 'shipDate': 'datetime'
} }
#Unique identifier for the order
self.id = None # long self.id = None # long
#ID of pet being ordered
self.petId = None # long self.petId = None # long
#Order Status #Number of pets ordered
self.status = None # str
self.quantity = None # int self.quantity = None # int
#Status of the order
self.status = None # str
#Date shipped, only if it has been
self.shipDate = None # datetime self.shipDate = None # datetime

View File

@ -21,21 +21,26 @@ class Pet:
def __init__(self): def __init__(self):
self.swaggerTypes = { self.swaggerTypes = {
'tags': 'list[Tag]',
'id': 'long', 'id': 'long',
'category': 'Category', 'category': 'Category',
'status': 'str',
'name': 'str', 'name': 'str',
'photoUrls': 'list[str]' 'photoUrls': 'list[str]',
'tags': 'list[Tag]',
'status': 'str'
} }
self.tags = None # list[Tag] #Unique identifier for the Pet
self.id = None # long self.id = None # long
#Category the pet is in
self.category = None # Category self.category = None # Category
#Friendly name of the pet
self.name = None # str
#Image URLs
self.photoUrls = None # list[str]
#Tags assigned to this pet
self.tags = None # list[Tag]
#pet status in the store #pet status in the store
self.status = None # str self.status = None # str
self.name = None # str
self.photoUrls = None # list[str]

View File

@ -27,6 +27,8 @@ class Tag:
} }
#Unique identifier for the tag
self.id = None # long self.id = None # long
#Friendly name for the tag
self.name = None # str self.name = None # str

View File

@ -22,24 +22,31 @@ class User:
def __init__(self): def __init__(self):
self.swaggerTypes = { self.swaggerTypes = {
'id': 'long', 'id': 'long',
'lastName': 'str',
'phone': 'str',
'username': 'str', 'username': 'str',
'email': 'str',
'userStatus': 'int',
'firstName': 'str', 'firstName': 'str',
'password': 'str' 'lastName': 'str',
'email': 'str',
'password': 'str',
'phone': 'str',
'userStatus': 'int'
} }
#Unique identifier for the user
self.id = None # long self.id = None # long
self.lastName = None # str #Unique username
self.phone = None # str
self.username = None # str self.username = None # str
#First name of the user
self.firstName = None # str
#Last name of the user
self.lastName = None # str
#Email address of the user
self.email = None # str self.email = None # str
#Password name of the user
self.password = None # str
#Phone number of the user
self.phone = None # str
#User Status #User Status
self.userStatus = None # int self.userStatus = None # int
self.firstName = None # str
self.password = None # str

View File

@ -36,7 +36,7 @@ class ApiClient:
for param, value in headerParams.iteritems(): for param, value in headerParams.iteritems():
headers[param] = value headers[param] = value
headers['Content-type'] = 'application/json' #headers['Content-type'] = 'application/json'
headers['api_key'] = self.apiKey headers['api_key'] = self.apiKey
if self.cookie: if self.cookie:
@ -44,8 +44,6 @@ class ApiClient:
data = None data = None
if method == 'GET':
if queryParams: if queryParams:
# Need to remove None values, these should not be sent # Need to remove None values, these should not be sent
sentQueryParams = {} sentQueryParams = {}
@ -54,6 +52,11 @@ class ApiClient:
sentQueryParams[param] = value sentQueryParams[param] = value
url = url + '?' + urllib.urlencode(sentQueryParams) url = url + '?' + urllib.urlencode(sentQueryParams)
if method in ['GET']:
#Options to add statements later on and for compatibility
pass
elif method in ['POST', 'PUT', 'DELETE']: elif method in ['POST', 'PUT', 'DELETE']:
if postData: if postData:
@ -81,21 +84,21 @@ class ApiClient:
return data return data
def toPathValue(self, obj): def toPathValue(self, obj):
"""Serialize a list to a CSV string, if necessary. """Convert a string or object to a path-friendly value
Args: Args:
obj -- data object to be serialized obj -- object or string value
Returns: Returns:
string -- json serialization of object string -- quoted value
""" """
if type(obj) == list: if type(obj) == list:
return ','.join(obj) return urllib.quote(','.join(obj))
else: else:
return obj return urllib.quote(str(obj))
def sanitizeForSerialization(self, obj): def sanitizeForSerialization(self, obj):
"""Dump an object into JSON for POSTing.""" """Dump an object into JSON for POSTing."""
if not obj: if type(obj) == type(None):
return None return None
elif type(obj) in [str, int, long, float, bool]: elif type(obj) in [str, int, long, float, bool]:
return obj return obj
@ -139,12 +142,12 @@ class ApiClient:
subClass = match.group(1) subClass = match.group(1)
return [self.deserialize(subObj, subClass) for subObj in obj] return [self.deserialize(subObj, subClass) for subObj in obj]
if (objClass in ['int', 'float', 'long', 'dict', 'list', 'str']): if (objClass in ['int', 'float', 'long', 'dict', 'list', 'str', 'bool', 'datetime']):
objClass = eval(objClass) objClass = eval(objClass)
else: # not a native type, must be model class else: # not a native type, must be model class
objClass = eval(objClass + '.' + objClass) objClass = eval(objClass + '.' + objClass)
if objClass in [str, int, long, float, bool]: if objClass in [int, long, float, dict, list, str, bool]:
return objClass(obj) return objClass(obj)
elif objClass == datetime: elif objClass == datetime:
# Server will always return a time stamp in UTC, but with # Server will always return a time stamp in UTC, but with
@ -164,7 +167,12 @@ class ApiClient:
value = attrType(value) value = attrType(value)
except UnicodeEncodeError: except UnicodeEncodeError:
value = unicode(value) value = unicode(value)
except TypeError:
value = value
setattr(instance, attr, value) setattr(instance, attr, value)
elif (attrType == 'datetime'):
setattr(instance, attr, datetime.datetime.strptime(value[:-5],
"%Y-%m-%dT%H:%M:%S.%f"))
elif 'list[' in attrType: elif 'list[' in attrType:
match = re.match('list\[(.*)\]', attrType) match = re.match('list\[(.*)\]', attrType)
subClass = match.group(1) subClass = match.group(1)
@ -198,3 +206,4 @@ class MethodRequest(urllib2.Request):
def get_method(self): def get_method(self):
return getattr(self, 'method', urllib2.Request.get_method(self)) return getattr(self, 'method', urllib2.Request.get_method(self))

View File

@ -14,10 +14,11 @@ class Pet_api
# verify existence of params # verify existence of params
raise "pet_id is required" if pet_id.nil? raise "pet_id is required" if pet_id.nil?
# set default values and merge with input # set default values and merge with input
options = { :pet_id => pet_id}.merge(opts) options = {
:pet_id => pet_id}.merge(opts)
#resource path #resource path
path = "/pet.{format}/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id)) path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
# pull querystring keys from options # pull querystring keys from options
@ -31,16 +32,155 @@ class Pet_api
Pet.new(response) Pet.new(response)
end end
def self.delete_pet (pet_id,opts={})
query_param_keys = []
# verify existence of params
raise "pet_id is required" if pet_id.nil?
# set default values and merge with input
options = {
:pet_id => pet_id}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
# pull querystring keys from options
queryopts = options.select do |key,value|
query_param_keys.include? key
end
headers = nil
post_body = nil
Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
end
def self.partial_update (pet_id,body,opts={})
query_param_keys = []
# verify existence of params
raise "pet_id is required" if pet_id.nil?
raise "body is required" if body.nil?
# set default values and merge with input
options = {
:pet_id => pet_id,
:body => body}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
# pull querystring keys from options
queryopts = options.select do |key,value|
query_param_keys.include? key
end
headers = nil
post_body = nil
if body != nil
if body.is_a?(Array)
array = Array.new
body.each do |item|
if item.respond_to?("to_body".to_sym)
array.push item.to_body
else
array.push item
end
end
post_body = array
else
if body.respond_to?("to_body".to_sym)
post_body = body.to_body
else
post_body = body
end
end
end
response = Swagger::Request.new(:PATCH, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
response.map {|response|Pet.new(response)}
end
def self.update_pet_with_form (pet_id,name,status,opts={})
query_param_keys = []
# verify existence of params
raise "pet_id is required" if pet_id.nil?
# set default values and merge with input
options = {
:pet_id => pet_id,
:name => name,
:status => status}.merge(opts)
#resource path
path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', escapeString(pet_id))
# pull querystring keys from options
queryopts = options.select do |key,value|
query_param_keys.include? key
end
headers = nil
post_body = nil
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
end
def self.upload_file (additional_metadata,body,opts={})
query_param_keys = []
# set default values and merge with input
options = {
:additional_metadata => additional_metadata,
:body => body}.merge(opts)
#resource path
path = "/pet/uploadImage".sub('{format}','json')
# pull querystring keys from options
queryopts = options.select do |key,value|
query_param_keys.include? key
end
headers = nil
post_body = nil
if body != nil
if body.is_a?(Array)
array = Array.new
body.each do |item|
if item.respond_to?("to_body".to_sym)
array.push item.to_body
else
array.push item
end
end
post_body = array
else
if body.respond_to?("to_body".to_sym)
post_body = body.to_body
else
post_body = body
end
end
end
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body}).make
end
def self.add_pet (body,opts={}) def self.add_pet (body,opts={})
query_param_keys = [] query_param_keys = []
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/pet.{format}".sub('{format}','json') path = "/pet".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -79,10 +219,11 @@ def self.update_pet (body,opts={})
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/pet.{format}".sub('{format}','json') path = "/pet".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -121,10 +262,11 @@ def self.find_pets_by_status (status= "available",opts={})
# verify existence of params # verify existence of params
raise "status is required" if status.nil? raise "status is required" if status.nil?
# set default values and merge with input # set default values and merge with input
options = { :status => status}.merge(opts) options = {
:status => status}.merge(opts)
#resource path #resource path
path = "/pet.{format}/findByStatus".sub('{format}','json') path = "/pet/findByStatus".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -143,10 +285,11 @@ def self.find_pets_by_tags (tags,opts={})
# verify existence of params # verify existence of params
raise "tags is required" if tags.nil? raise "tags is required" if tags.nil?
# set default values and merge with input # set default values and merge with input
options = { :tags => tags}.merge(opts) options = {
:tags => tags}.merge(opts)
#resource path #resource path
path = "/pet.{format}/findByTags".sub('{format}','json') path = "/pet/findByTags".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|

View File

@ -14,10 +14,11 @@ class Store_api
# verify existence of params # verify existence of params
raise "order_id is required" if order_id.nil? raise "order_id is required" if order_id.nil?
# set default values and merge with input # set default values and merge with input
options = { :order_id => order_id}.merge(opts) options = {
:order_id => order_id}.merge(opts)
#resource path #resource path
path = "/store.{format}/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id)) path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
# pull querystring keys from options # pull querystring keys from options
@ -37,10 +38,11 @@ def self.delete_order (order_id,opts={})
# verify existence of params # verify existence of params
raise "order_id is required" if order_id.nil? raise "order_id is required" if order_id.nil?
# set default values and merge with input # set default values and merge with input
options = { :order_id => order_id}.merge(opts) options = {
:order_id => order_id}.merge(opts)
#resource path #resource path
path = "/store.{format}/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id)) path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', escapeString(order_id))
# pull querystring keys from options # pull querystring keys from options
@ -60,10 +62,11 @@ def self.place_order (body,opts={})
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/store.{format}/order".sub('{format}','json') path = "/store/order".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|

View File

@ -8,16 +8,17 @@ class User_api
URI.encode(string.to_s) URI.encode(string.to_s)
end end
def self.create_users_with_array_input (body,opts={}) def self.create_user (body,opts={})
query_param_keys = [] query_param_keys = []
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/user.{format}/createWithArray".sub('{format}','json') path = "/user".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -50,16 +51,17 @@ class User_api
end end
def self.create_user (body,opts={}) def self.create_users_with_array_input (body,opts={})
query_param_keys = [] query_param_keys = []
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/user.{format}".sub('{format}','json') path = "/user/createWithArray".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -98,10 +100,11 @@ def self.create_users_with_list_input (body,opts={})
# verify existence of params # verify existence of params
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :body => body}.merge(opts) options = {
:body => body}.merge(opts)
#resource path #resource path
path = "/user.{format}/createWithList".sub('{format}','json') path = "/user/createWithList".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -141,10 +144,12 @@ def self.update_user (username,body,opts={})
raise "username is required" if username.nil? raise "username is required" if username.nil?
raise "body is required" if body.nil? raise "body is required" if body.nil?
# set default values and merge with input # set default values and merge with input
options = { :username => username, :body => body}.merge(opts) options = {
:username => username,
:body => body}.merge(opts)
#resource path #resource path
path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username)) path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options # pull querystring keys from options
@ -184,10 +189,11 @@ def self.delete_user (username,opts={})
# verify existence of params # verify existence of params
raise "username is required" if username.nil? raise "username is required" if username.nil?
# set default values and merge with input # set default values and merge with input
options = { :username => username}.merge(opts) options = {
:username => username}.merge(opts)
#resource path #resource path
path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username)) path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options # pull querystring keys from options
@ -207,10 +213,11 @@ def self.get_user_by_name (username,opts={})
# verify existence of params # verify existence of params
raise "username is required" if username.nil? raise "username is required" if username.nil?
# set default values and merge with input # set default values and merge with input
options = { :username => username}.merge(opts) options = {
:username => username}.merge(opts)
#resource path #resource path
path = "/user.{format}/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username)) path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', escapeString(username))
# pull querystring keys from options # pull querystring keys from options
@ -231,10 +238,12 @@ def self.login_user (username,password,opts={})
raise "username is required" if username.nil? raise "username is required" if username.nil?
raise "password is required" if password.nil? raise "password is required" if password.nil?
# set default values and merge with input # set default values and merge with input
options = { :username => username, :password => password}.merge(opts) options = {
:username => username,
:password => password}.merge(opts)
#resource path #resource path
path = "/user.{format}/login".sub('{format}','json') path = "/user/login".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|
@ -251,10 +260,11 @@ def self.logout_user (opts={})
query_param_keys = [] query_param_keys = []
# set default values and merge with input # set default values and merge with input
options = { }.merge(opts) options = {
}.merge(opts)
#resource path #resource path
path = "/user.{format}/logout".sub('{format}','json') path = "/user/logout".sub('{format}','json')
# pull querystring keys from options # pull querystring keys from options
queryopts = options.select do |key,value| queryopts = options.select do |key,value|

View File

@ -3,7 +3,8 @@ module Swagger
class Configuration class Configuration
require 'swagger/version' require 'swagger/version'
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path,
:user_agent, :logger, :inject_format
# Defaults go in here.. # Defaults go in here..
def initialize def initialize
@ -12,8 +13,10 @@ module Swagger
@host = 'api.wordnik.com' @host = 'api.wordnik.com'
@base_path = '/v4' @base_path = '/v4'
@user_agent = "ruby-#{Swagger::VERSION}" @user_agent = "ruby-#{Swagger::VERSION}"
@inject_format = true
end end
end end
end end

View File

@ -81,9 +81,11 @@ module Swagger
# Stick a .{format} placeholder into the path if there isn't # Stick a .{format} placeholder into the path if there isn't
# one already or an actual format like json or xml # one already or an actual format like json or xml
# e.g. /words/blah => /words.{format}/blah # e.g. /words/blah => /words.{format}/blah
if Swagger.configuration.inject_format
unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s } unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s }
p = p.sub(/^(\/?\w+)/, "\\1.#{format}") p = p.sub(/^(\/?\w+)/, "\\1.#{format}")
end end
end
p = p.sub("{format}", self.format.to_s) p = p.sub("{format}", self.format.to_s)
@ -184,3 +186,4 @@ module Swagger
end end
end end

View File

@ -4,31 +4,28 @@ class Category
# :internal => :external # :internal => :external
def self.attribute_map def self.attribute_map
{ {
:id => :id, :name => :name :id => :id,
:name => :name
} }
end end
def initialize(attributes = {}) def initialize(attributes = {})
return if attributes.empty?
# Morph attribute keys into undescored rubyish style # Morph attribute keys into undescored rubyish style
if attributes.to_s != "" if self.class.attribute_map[:"id"]
@id = attributes["id"]
end
if self.class.attribute_map[:"name"]
@name = attributes["name"]
end
if Category.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if Category.attribute_map["name".to_sym] != nil
name = "name".to_sym
value = attributes["name"]
send("#{name}=", value) if self.respond_to?(name)
end
end
end end
def to_body def to_body
body = {} body = {}
Category.attribute_map.each_pair do |key,value| self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil? body[value] = self.send(key) unless self.send(key).nil?
end end
body body

View File

@ -1,49 +1,43 @@
class Order class Order
attr_accessor :id, :pet_id, :status, :quantity, :ship_date attr_accessor :id, :pet_id, :quantity, :status, :ship_date
# :internal => :external # :internal => :external
def self.attribute_map def self.attribute_map
{ {
:id => :id, :pet_id => :petId, :status => :status, :quantity => :quantity, :ship_date => :shipDate :id => :id,
:pet_id => :petId,
:quantity => :quantity,
:status => :status,
:ship_date => :shipDate
} }
end end
def initialize(attributes = {}) def initialize(attributes = {})
return if attributes.empty?
# Morph attribute keys into undescored rubyish style # Morph attribute keys into undescored rubyish style
if attributes.to_s != "" if self.class.attribute_map[:"id"]
@id = attributes["id"]
end
if self.class.attribute_map[:"pet_id"]
@pet_id = attributes["petId"]
end
if self.class.attribute_map[:"quantity"]
@quantity = attributes["quantity"]
end
if self.class.attribute_map[:"status"]
@status = attributes["status"]
end
if self.class.attribute_map[:"ship_date"]
@ship_date = attributes["shipDate"]
end
if Order.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if Order.attribute_map["pet_id".to_sym] != nil
name = "pet_id".to_sym
value = attributes["petId"]
send("#{name}=", value) if self.respond_to?(name)
end
if Order.attribute_map["status".to_sym] != nil
name = "status".to_sym
value = attributes["status"]
send("#{name}=", value) if self.respond_to?(name)
end
if Order.attribute_map["quantity".to_sym] != nil
name = "quantity".to_sym
value = attributes["quantity"]
send("#{name}=", value) if self.respond_to?(name)
end
if Order.attribute_map["ship_date".to_sym] != nil
name = "ship_date".to_sym
value = attributes["shipDate"]
send("#{name}=", value) if self.respond_to?(name)
end
end
end end
def to_body def to_body
body = {} body = {}
Order.attribute_map.each_pair do |key,value| self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil? body[value] = self.send(key) unless self.send(key).nil?
end end
body body

View File

@ -1,66 +1,49 @@
class Pet class Pet
attr_accessor :tags, :id, :category, :status, :name, :photo_urls attr_accessor :id, :category, :name, :photo_urls, :tags, :status
# :internal => :external # :internal => :external
def self.attribute_map def self.attribute_map
{ {
:tags => :tags, :id => :id, :category => :category, :status => :status, :name => :name, :photo_urls => :photoUrls :id => :id,
:category => :category,
:name => :name,
:photo_urls => :photoUrls,
:tags => :tags,
:status => :status
} }
end end
def initialize(attributes = {}) def initialize(attributes = {})
return if attributes.empty?
# Morph attribute keys into undescored rubyish style # Morph attribute keys into undescored rubyish style
if attributes.to_s != "" if self.class.attribute_map[:"id"]
@id = attributes["id"]
end
if self.class.attribute_map[:"category"]
@category = attributes["category"]
end
if self.class.attribute_map[:"name"]
@name = attributes["name"]
end
if self.class.attribute_map[:"photo_urls"]
if (value = attributes["photoUrls"]).is_a?(Array)
@photo_urls = valueend
end
if self.class.attribute_map[:"tags"]
if (value = attributes["tags"]).is_a?(Array)
@tags = value.map{ |v| Tag.new(v) }end
end
if self.class.attribute_map[:"status"]
@status = attributes["status"]
end
if Pet.attribute_map["tags".to_sym] != nil
name = "tags".to_sym
value = attributes["tags"]
if value.is_a?(Array)
array = Array.new
value.each do |arrayValue|
array.push Tag.new(arrayValue)
end
send("#{name}=", array) if self.respond_to?(name)
end
end
if Pet.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["category".to_sym] != nil
name = "category".to_sym
value = attributes["category"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["status".to_sym] != nil
name = "status".to_sym
value = attributes["status"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["name".to_sym] != nil
name = "name".to_sym
value = attributes["name"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["photo_urls".to_sym] != nil
name = "photo_urls".to_sym
value = attributes["photoUrls"]
if value.is_a?(Array)
array = Array.new
value.each do |arrayValue|
array.push arrayValue
end
send("#{name}=", array) if self.respond_to?(name)
end
end
end
end end
def to_body def to_body
body = {} body = {}
Pet.attribute_map.each_pair do |key,value| self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil? body[value] = self.send(key) unless self.send(key).nil?
end end
body body

View File

@ -4,31 +4,28 @@ class Tag
# :internal => :external # :internal => :external
def self.attribute_map def self.attribute_map
{ {
:id => :id, :name => :name :id => :id,
:name => :name
} }
end end
def initialize(attributes = {}) def initialize(attributes = {})
return if attributes.empty?
# Morph attribute keys into undescored rubyish style # Morph attribute keys into undescored rubyish style
if attributes.to_s != "" if self.class.attribute_map[:"id"]
@id = attributes["id"]
end
if self.class.attribute_map[:"name"]
@name = attributes["name"]
end
if Tag.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if Tag.attribute_map["name".to_sym] != nil
name = "name".to_sym
value = attributes["name"]
send("#{name}=", value) if self.respond_to?(name)
end
end
end end
def to_body def to_body
body = {} body = {}
Tag.attribute_map.each_pair do |key,value| self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil? body[value] = self.send(key) unless self.send(key).nil?
end end
body body

View File

@ -1,64 +1,55 @@
class User class User
attr_accessor :id, :last_name, :phone, :username, :email, :user_status, :first_name, :password attr_accessor :id, :username, :first_name, :last_name, :email, :password, :phone, :user_status
# :internal => :external # :internal => :external
def self.attribute_map def self.attribute_map
{ {
:id => :id, :last_name => :lastName, :phone => :phone, :username => :username, :email => :email, :user_status => :userStatus, :first_name => :firstName, :password => :password :id => :id,
:username => :username,
:first_name => :firstName,
:last_name => :lastName,
:email => :email,
:password => :password,
:phone => :phone,
:user_status => :userStatus
} }
end end
def initialize(attributes = {}) def initialize(attributes = {})
return if attributes.empty?
# Morph attribute keys into undescored rubyish style # Morph attribute keys into undescored rubyish style
if attributes.to_s != "" if self.class.attribute_map[:"id"]
@id = attributes["id"]
end
if self.class.attribute_map[:"username"]
@username = attributes["username"]
end
if self.class.attribute_map[:"first_name"]
@first_name = attributes["firstName"]
end
if self.class.attribute_map[:"last_name"]
@last_name = attributes["lastName"]
end
if self.class.attribute_map[:"email"]
@email = attributes["email"]
end
if self.class.attribute_map[:"password"]
@password = attributes["password"]
end
if self.class.attribute_map[:"phone"]
@phone = attributes["phone"]
end
if self.class.attribute_map[:"user_status"]
@user_status = attributes["userStatus"]
end
if User.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["last_name".to_sym] != nil
name = "last_name".to_sym
value = attributes["lastName"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["phone".to_sym] != nil
name = "phone".to_sym
value = attributes["phone"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["username".to_sym] != nil
name = "username".to_sym
value = attributes["username"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["email".to_sym] != nil
name = "email".to_sym
value = attributes["email"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["user_status".to_sym] != nil
name = "user_status".to_sym
value = attributes["userStatus"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["first_name".to_sym] != nil
name = "first_name".to_sym
value = attributes["firstName"]
send("#{name}=", value) if self.respond_to?(name)
end
if User.attribute_map["password".to_sym] != nil
name = "password".to_sym
value = attributes["password"]
send("#{name}=", value) if self.respond_to?(name)
end
end
end end
def to_body def to_body
body = {} body = {}
User.attribute_map.each_pair do |key,value| self.class.attribute_map.each_pair do |key, value|
body[value] = self.send(key) unless self.send(key).nil? body[value] = self.send(key) unless self.send(key).nil?
end end
body body

View File

@ -43,7 +43,7 @@ class UserApi {
case ex: ApiException => throw ex case ex: ApiException => throw ex
} }
} }
def createUsersWithArrayInput (body: Array[User]) = { def createUsersWithArrayInput (body: List[User]) = {
// create path and map variables // create path and map variables
val path = "/user/createWithArray".replaceAll("\\{format\\}","json") val path = "/user/createWithArray".replaceAll("\\{format\\}","json")
val contentType = { val contentType = {
@ -71,7 +71,7 @@ class UserApi {
case ex: ApiException => throw ex case ex: ApiException => throw ex
} }
} }
def createUsersWithListInput (body: Array[User]) = { def createUsersWithListInput (body: List[User]) = {
// create path and map variables // create path and map variables
val path = "/user/createWithList".replaceAll("\\{format\\}","json") val path = "/user/createWithList".replaceAll("\\{format\\}","json")
val contentType = { val contentType = {

View File

@ -79,7 +79,7 @@ class UserApiTest extends FlatSpec with ShouldMatchers {
"XXXXXXXXXXX", "XXXXXXXXXXX",
"408-867-5309", "408-867-5309",
1) 1)
}).toArray }).toList
api.createUsersWithArrayInput(userArray) api.createUsersWithArrayInput(userArray)
for (i <- (1 to 2)) { for (i <- (1 to 2)) {
@ -104,7 +104,7 @@ class UserApiTest extends FlatSpec with ShouldMatchers {
"XXXXXXXXXXX", "XXXXXXXXXXX",
"408-867-5309", "408-867-5309",
1) 1)
}).toArray }).toList
api.createUsersWithListInput(userList) api.createUsersWithListInput(userList)
for (i <- (1 to 3)) { for (i <- (1 to 3)) {