Merge pull request #1456 from wing328/master

[C#] update C# petstore sample code
This commit is contained in:
wing328 2015-10-28 16:08:49 +08:00
commit 2e6199ac3b
8 changed files with 113 additions and 110 deletions

View File

@ -248,7 +248,7 @@ namespace IO.Swagger.Api
{
var path = "/pet";
var path_ = "/pet";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -279,7 +279,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
@ -298,7 +298,7 @@ namespace IO.Swagger.Api
{
var path = "/pet";
var path_ = "/pet";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -329,7 +329,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
@ -346,7 +346,7 @@ namespace IO.Swagger.Api
{
var path = "/pet";
var path_ = "/pet";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -377,7 +377,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
@ -396,7 +396,7 @@ namespace IO.Swagger.Api
{
var path = "/pet";
var path_ = "/pet";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -427,7 +427,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
@ -444,7 +444,7 @@ namespace IO.Swagger.Api
{
var path = "/pet/findByStatus";
var path_ = "/pet/findByStatus";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -475,14 +475,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
}
/// <summary>
@ -494,7 +494,7 @@ namespace IO.Swagger.Api
{
var path = "/pet/findByStatus";
var path_ = "/pet/findByStatus";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -525,11 +525,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
}
/// <summary>
@ -541,7 +541,7 @@ namespace IO.Swagger.Api
{
var path = "/pet/findByTags";
var path_ = "/pet/findByTags";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -572,14 +572,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
}
/// <summary>
@ -591,7 +591,7 @@ namespace IO.Swagger.Api
{
var path = "/pet/findByTags";
var path_ = "/pet/findByTags";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -622,11 +622,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
return (List<Pet>) ApiClient.Deserialize(response.Content, typeof(List<Pet>), response.Headers);
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
}
/// <summary>
@ -641,7 +641,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -669,17 +669,17 @@ namespace IO.Swagger.Api
// authentication setting, if any
String[] authSettings = new String[] { "api_key", "petstore_auth" };
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers);
return (Pet) ApiClient.Deserialize(response, typeof(Pet));
}
/// <summary>
@ -693,7 +693,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -721,14 +721,14 @@ namespace IO.Swagger.Api
// authentication setting, if any
String[] authSettings = new String[] { "api_key", "petstore_auth" };
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers);
return (Pet) ApiClient.Deserialize(response, typeof(Pet));
}
/// <summary>
@ -745,7 +745,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -778,7 +778,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
@ -801,7 +801,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -834,7 +834,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
@ -855,7 +855,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -887,7 +887,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
@ -909,7 +909,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
var path = "/pet/{petId}";
var path_ = "/pet/{petId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -941,7 +941,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
@ -963,7 +963,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile");
var path = "/pet/{petId}/uploadImage";
var path_ = "/pet/{petId}/uploadImage";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -996,7 +996,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
@ -1019,7 +1019,7 @@ namespace IO.Swagger.Api
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile");
var path = "/pet/{petId}/uploadImage";
var path_ = "/pet/{petId}/uploadImage";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -1052,7 +1052,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);

View File

@ -155,7 +155,7 @@ namespace IO.Swagger.Api
{
var path = "/store/inventory";
var path_ = "/store/inventory";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -185,14 +185,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
return (Dictionary<string, int?>) ApiClient.Deserialize(response.Content, typeof(Dictionary<string, int?>), response.Headers);
return (Dictionary<string, int?>) ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
}
/// <summary>
@ -203,7 +203,7 @@ namespace IO.Swagger.Api
{
var path = "/store/inventory";
var path_ = "/store/inventory";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -233,11 +233,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
return (Dictionary<string, int?>) ApiClient.Deserialize(response.Content, typeof(Dictionary<string, int?>), response.Headers);
return (Dictionary<string, int?>) ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
}
/// <summary>
@ -249,7 +249,7 @@ namespace IO.Swagger.Api
{
var path = "/store/order";
var path_ = "/store/order";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -280,14 +280,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
return (Order) ApiClient.Deserialize(response, typeof(Order));
}
/// <summary>
@ -299,7 +299,7 @@ namespace IO.Swagger.Api
{
var path = "/store/order";
var path_ = "/store/order";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -330,11 +330,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
return (Order) ApiClient.Deserialize(response, typeof(Order));
}
/// <summary>
@ -349,7 +349,7 @@ namespace IO.Swagger.Api
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById");
var path = "/store/order/{orderId}";
var path_ = "/store/order/{orderId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -380,14 +380,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
return (Order) ApiClient.Deserialize(response, typeof(Order));
}
/// <summary>
@ -401,7 +401,7 @@ namespace IO.Swagger.Api
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById");
var path = "/store/order/{orderId}";
var path_ = "/store/order/{orderId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -432,11 +432,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers);
return (Order) ApiClient.Deserialize(response, typeof(Order));
}
/// <summary>
@ -451,7 +451,7 @@ namespace IO.Swagger.Api
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder");
var path = "/store/order/{orderId}";
var path_ = "/store/order/{orderId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -482,7 +482,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
@ -503,7 +503,7 @@ namespace IO.Swagger.Api
if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder");
var path = "/store/order/{orderId}";
var path_ = "/store/order/{orderId}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -534,7 +534,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);

View File

@ -240,7 +240,7 @@ namespace IO.Swagger.Api
{
var path = "/user";
var path_ = "/user";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -271,7 +271,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
@ -290,7 +290,7 @@ namespace IO.Swagger.Api
{
var path = "/user";
var path_ = "/user";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -321,7 +321,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
@ -338,7 +338,7 @@ namespace IO.Swagger.Api
{
var path = "/user/createWithArray";
var path_ = "/user/createWithArray";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -369,7 +369,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
@ -388,7 +388,7 @@ namespace IO.Swagger.Api
{
var path = "/user/createWithArray";
var path_ = "/user/createWithArray";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -419,7 +419,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
@ -436,7 +436,7 @@ namespace IO.Swagger.Api
{
var path = "/user/createWithList";
var path_ = "/user/createWithList";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -467,7 +467,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
@ -486,7 +486,7 @@ namespace IO.Swagger.Api
{
var path = "/user/createWithList";
var path_ = "/user/createWithList";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -517,7 +517,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
@ -535,7 +535,7 @@ namespace IO.Swagger.Api
{
var path = "/user/login";
var path_ = "/user/login";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -567,14 +567,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers);
return (string) ApiClient.Deserialize(response, typeof(string));
}
/// <summary>
@ -587,7 +587,7 @@ namespace IO.Swagger.Api
{
var path = "/user/login";
var path_ = "/user/login";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -619,11 +619,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers);
return (string) ApiClient.Deserialize(response, typeof(string));
}
/// <summary>
@ -634,7 +634,7 @@ namespace IO.Swagger.Api
{
var path = "/user/logout";
var path_ = "/user/logout";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -664,7 +664,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
@ -682,7 +682,7 @@ namespace IO.Swagger.Api
{
var path = "/user/logout";
var path_ = "/user/logout";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -712,7 +712,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
@ -732,7 +732,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -763,14 +763,14 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
else if (((int)response.StatusCode) == 0)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers);
return (User) ApiClient.Deserialize(response, typeof(User));
}
/// <summary>
@ -784,7 +784,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -815,11 +815,11 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers);
return (User) ApiClient.Deserialize(response, typeof(User));
}
/// <summary>
@ -835,7 +835,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -867,7 +867,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
@ -889,7 +889,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -921,7 +921,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
@ -941,7 +941,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -972,7 +972,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
@ -993,7 +993,7 @@ namespace IO.Swagger.Api
if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser");
var path = "/user/{username}";
var path_ = "/user/{username}";
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>();
@ -1024,7 +1024,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);

View File

@ -214,12 +214,14 @@ namespace IO.Swagger.Client
/// <summary>
/// Deserialize the JSON string into a proper object.
/// </summary>
/// <param name="content">HTTP body (e.g. string, JSON).</param>
/// <param name="response">The HTTP response.</param>
/// <param name="type">Object type.</param>
/// <param name="headers"></param>
/// <returns>Object representation of the JSON string.</returns>
public object Deserialize(string content, Type type, IList<Parameter> headers=null)
public object Deserialize(IRestResponse response, Type type)
{
byte[] data = response.RawBytes;
string content = response.Content;
IList<Parameter> headers = response.Headers;
if (type == typeof(Object)) // return an object
{
return content;
@ -227,21 +229,22 @@ namespace IO.Swagger.Client
if (type == typeof(Stream))
{
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
? Path.GetTempPath()
: Configuration.TempFolderPath;
var fileName = filePath + Guid.NewGuid();
if (headers != null)
{
var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
? Path.GetTempPath()
: Configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
var match = regex.Match(headers.ToString());
if (match.Success)
fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
{
string fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
File.WriteAllBytes(fileName, data);
return new FileStream(fileName, FileMode.Open);
}
}
File.WriteAllText(fileName, content);
return new FileStream(fileName, FileMode.Open);
var stream = new MemoryStream(data);
return stream;
}
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object