forked from loafle/openapi-generator-original
add test case for status code and response header
This commit is contained in:
parent
6405fba663
commit
c9f2380f0f
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using {{packageName}}.Client;
|
||||
{{#hasImport}}using {{packageName}}.Model;
|
||||
@ -90,6 +91,16 @@ namespace {{packageName}}.Api
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status code of the previous request
|
||||
/// </summary>
|
||||
public int StatusCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response headers of the previous request
|
||||
/// </summary>
|
||||
public Dictionary<String, String> ResponseHeaders { get; private set; }
|
||||
|
||||
{{#operation}}
|
||||
/// <summary>
|
||||
@ -162,11 +173,14 @@ namespace {{packageName}}.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.{{httpMethod}}, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling {{operationId}}: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling {{operationId}}: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling {{operationId}}: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling {{operationId}}: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
{{#returnType}}return ({{{returnType}}}) Configuration.ApiClient.Deserialize(response, typeof({{{returnType}}}));{{/returnType}}{{^returnType}}return;{{/returnType}}
|
||||
}
|
||||
@ -240,8 +254,12 @@ namespace {{packageName}}.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.{{httpMethod}}, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling {{operationId}}: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling {{operationId}}: " + response.Content, response.Content);
|
||||
|
||||
{{#returnType}}return ({{{returnType}}}) Configuration.ApiClient.Deserialize(response, typeof({{{returnType}}}));{{/returnType}}{{^returnType}}
|
||||
return;{{/returnType}}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
@ -203,7 +204,7 @@ namespace IO.Swagger.Api
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PetApi"/> class
|
||||
/// using Configuration object
|
||||
/// using Configuration object.
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
@ -235,11 +236,20 @@ namespace IO.Swagger.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration object
|
||||
/// Gets or sets the configuration object.
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status code of the previous request.
|
||||
/// </summary>
|
||||
public int StatusCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response headers of the previous request.
|
||||
/// </summary>
|
||||
public Dictionary<String, String> ResponseHeaders { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
@ -289,11 +299,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -346,8 +359,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -401,11 +418,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling AddPet: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -458,8 +478,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling AddPet: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -513,11 +537,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
@ -570,8 +597,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
|
||||
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
@ -624,11 +655,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
@ -681,8 +715,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
|
||||
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
@ -738,11 +776,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Pet) Configuration.ApiClient.Deserialize(response, typeof(Pet));
|
||||
}
|
||||
@ -797,8 +838,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
|
||||
|
||||
return (Pet) Configuration.ApiClient.Deserialize(response, typeof(Pet));
|
||||
}
|
||||
@ -858,11 +903,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -921,8 +969,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -981,11 +1033,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1042,8 +1097,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -1104,11 +1163,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1167,8 +1229,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
@ -147,6 +148,16 @@ namespace IO.Swagger.Api
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status code of the previous request
|
||||
/// </summary>
|
||||
public int StatusCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response headers of the previous request
|
||||
/// </summary>
|
||||
public Dictionary<String, String> ResponseHeaders { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -195,11 +206,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Dictionary<string, int?>) Configuration.ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
}
|
||||
@ -250,8 +264,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
|
||||
|
||||
return (Dictionary<string, int?>) Configuration.ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
}
|
||||
@ -296,11 +314,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
@ -345,8 +366,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
|
||||
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
@ -394,11 +419,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
@ -445,8 +473,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
|
||||
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
@ -494,11 +526,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -545,8 +580,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
@ -231,6 +232,16 @@ namespace IO.Swagger.Api
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status code of the previous request
|
||||
/// </summary>
|
||||
public int StatusCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response headers of the previous request
|
||||
/// </summary>
|
||||
public Dictionary<String, String> ResponseHeaders { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -273,11 +284,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -322,8 +336,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -369,11 +387,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -418,8 +439,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -465,11 +490,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -514,8 +542,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -563,11 +595,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (string) Configuration.ApiClient.Deserialize(response, typeof(string));
|
||||
}
|
||||
@ -614,8 +649,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
|
||||
|
||||
return (string) Configuration.ApiClient.Deserialize(response, typeof(string));
|
||||
}
|
||||
@ -658,11 +697,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -705,8 +747,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -755,11 +801,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (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);
|
||||
throw new ApiException (StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (User) Configuration.ApiClient.Deserialize(response, typeof(User));
|
||||
}
|
||||
@ -806,8 +855,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
|
||||
|
||||
return (User) Configuration.ApiClient.Deserialize(response, typeof(User));
|
||||
}
|
||||
@ -857,11 +910,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -910,8 +966,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
@ -960,11 +1020,14 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
throw new ApiException (StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1011,8 +1074,12 @@ namespace IO.Swagger.Api
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
|
||||
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
|
||||
if (StatusCode >= 400)
|
||||
throw new ApiException (StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
|
||||
|
||||
|
||||
return;
|
||||
|
@ -229,6 +229,19 @@ namespace SwaggerClient.TestPet
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test status code
|
||||
/// </summary>
|
||||
[Test ()]
|
||||
public void TestStatusCodeAndHeader ()
|
||||
{
|
||||
PetApi petApi = new PetApi ();
|
||||
petApi.GetPetById (petId);
|
||||
Assert.AreEqual (petApi.StatusCode, 200);
|
||||
Assert.IsTrue (petApi.ResponseHeaders.ContainsKey("Content-Type"));
|
||||
Assert.AreEqual (petApi.ResponseHeaders["Content-Type"], "application/json");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user