remove leading space for path variable, update unit test

This commit is contained in:
wing328 2015-07-20 10:43:08 +08:00
parent a863e538a8
commit 596bde2ef6
51 changed files with 88752 additions and 231 deletions

View File

@ -104,11 +104,11 @@ namespace {{packageName}}.Api
String postBody = null; String postBody = null;
pathParams.Add("format", "json"); pathParams.Add("format", "json");
{{#pathParams}} if ({{paramName}} != null) pathParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // path parameter {{#pathParams}}if ({{paramName}} != null) pathParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // path parameter
{{/pathParams}} {{/pathParams}}
{{#queryParams}} if ({{paramName}} != null) queryParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // query parameter {{#queryParams}}if ({{paramName}} != null) queryParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // query parameter
{{/queryParams}} {{/queryParams}}
{{#headerParams}} if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter {{#headerParams}}if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter
{{/headerParams}} {{/headerParams}}
{{#formParams}}if ({{paramName}} != null) {{#isFile}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} {{#formParams}}if ({{paramName}} != null) {{#isFile}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
{{/formParams}} {{/formParams}}
@ -150,11 +150,11 @@ namespace {{packageName}}.Api
String postBody = null; String postBody = null;
pathParams.Add("format", "json"); pathParams.Add("format", "json");
{{#pathParams}} if ({{paramName}} != null) pathParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // path parameter {{#pathParams}}if ({{paramName}} != null) pathParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // path parameter
{{/pathParams}} {{/pathParams}}
{{#queryParams}} if ({{paramName}} != null) queryParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // query parameter {{#queryParams}}if ({{paramName}} != null) queryParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // query parameter
{{/queryParams}} {{/queryParams}}
{{#headerParams}} if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter {{#headerParams}}if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter
{{/headerParams}} {{/headerParams}}
{{#formParams}}if ({{paramName}} != null) {{#isFile}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}} {{#formParams}}if ({{paramName}} != null) {{#isFile}}fileParams.Add("{{baseName}}", ApiClient.ParameterToFile("{{baseName}}", {{paramName}}));{{/isFile}}{{^isFile}}formParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // form parameter{{/isFile}}
{{/formParams}} {{/formParams}}

View File

@ -102,18 +102,18 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Deletes a pet /// Deletes a pet
/// </summary> /// </summary>
/// <param name="apiKey"></param>
/// <param name="petId">Pet id to delete</param> /// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns> /// <returns></returns>
void DeletePet (string apiKey, long? petId); void DeletePet (long? petId, string apiKey);
/// <summary> /// <summary>
/// Deletes a pet /// Deletes a pet
/// </summary> /// </summary>
/// <param name="apiKey"></param>
/// <param name="petId">Pet id to delete</param> /// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns> /// <returns></returns>
System.Threading.Tasks.Task DeletePetAsync (string apiKey, long? petId); System.Threading.Tasks.Task DeletePetAsync (long? petId, string apiKey);
/// <summary> /// <summary>
/// uploads an image /// uploads an image
@ -199,15 +199,16 @@ namespace IO.Swagger.Api
var path = "/pet"; var path = "/pet";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -218,7 +219,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
@ -238,15 +239,16 @@ namespace IO.Swagger.Api
var path = "/pet"; var path = "/pet";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -257,7 +259,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
@ -275,15 +277,16 @@ namespace IO.Swagger.Api
var path = "/pet"; var path = "/pet";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -294,7 +297,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
@ -314,15 +317,16 @@ namespace IO.Swagger.Api
var path = "/pet"; var path = "/pet";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -333,7 +337,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
@ -351,16 +355,17 @@ namespace IO.Swagger.Api
var path = "/pet/findByStatus"; var path = "/pet/findByStatus";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter pathParams.Add("format", "json");
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
@ -370,7 +375,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
@ -390,16 +395,17 @@ namespace IO.Swagger.Api
var path = "/pet/findByStatus"; var path = "/pet/findByStatus";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter pathParams.Add("format", "json");
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
@ -409,7 +415,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
@ -426,16 +432,17 @@ namespace IO.Swagger.Api
var path = "/pet/findByTags"; var path = "/pet/findByTags";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter pathParams.Add("format", "json");
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
@ -445,7 +452,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
@ -465,16 +472,17 @@ namespace IO.Swagger.Api
var path = "/pet/findByTags"; var path = "/pet/findByTags";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter pathParams.Add("format", "json");
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
@ -484,7 +492,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
@ -504,16 +512,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
@ -523,7 +532,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key", "petstore_auth" }; String[] authSettings = new String[] { "api_key", "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
@ -545,16 +554,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
@ -564,7 +574,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key", "petstore_auth" }; String[] authSettings = new String[] { "api_key", "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
@ -586,16 +596,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
@ -607,7 +618,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
@ -631,16 +642,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
@ -652,7 +664,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
@ -663,10 +675,10 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Deletes a pet /// Deletes a pet
/// </summary> /// </summary>
/// <param name="apiKey"></param>
/// <param name="petId">Pet id to delete</param> /// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns> /// <returns></returns>
public void DeletePet (string apiKey, long? petId) public void DeletePet (long? petId, string apiKey)
{ {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
@ -674,18 +686,19 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
@ -694,7 +707,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
@ -707,28 +720,29 @@ namespace IO.Swagger.Api
/// <summary> /// <summary>
/// Deletes a pet /// Deletes a pet
/// </summary> /// </summary>
/// <param name="apiKey"></param>
/// <param name="petId">Pet id to delete</param> /// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns> /// <returns></returns>
public async System.Threading.Tasks.Task DeletePetAsync (string apiKey, long? petId) public async System.Threading.Tasks.Task DeletePetAsync (long? petId, string apiKey)
{ {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet"); if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet");
var path = "/pet/{petId}"; var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
@ -737,7 +751,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
@ -760,16 +774,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}/uploadImage"; var path = "/pet/{petId}/uploadImage";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
@ -781,7 +796,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
@ -805,16 +820,17 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}/uploadImage"; var path = "/pet/{petId}/uploadImage";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
@ -826,7 +842,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "petstore_auth" }; String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);

View File

@ -130,15 +130,16 @@ namespace IO.Swagger.Api
var path = "/store/inventory"; var path = "/store/inventory";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -148,7 +149,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key" }; String[] authSettings = new String[] { "api_key" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
@ -167,15 +168,16 @@ namespace IO.Swagger.Api
var path = "/store/inventory"; var path = "/store/inventory";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -185,7 +187,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { "api_key" }; String[] authSettings = new String[] { "api_key" };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
@ -202,15 +204,16 @@ namespace IO.Swagger.Api
var path = "/store/order"; var path = "/store/order";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -221,7 +224,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
@ -241,15 +244,16 @@ namespace IO.Swagger.Api
var path = "/store/order"; var path = "/store/order";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -260,7 +264,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
@ -280,16 +284,17 @@ namespace IO.Swagger.Api
var path = "/store/order/{orderId}"; var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
@ -299,7 +304,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
@ -321,16 +326,17 @@ namespace IO.Swagger.Api
var path = "/store/order/{orderId}"; var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
@ -340,7 +346,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
@ -360,16 +366,17 @@ namespace IO.Swagger.Api
var path = "/store/order/{orderId}"; var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
@ -379,7 +386,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
@ -401,16 +408,17 @@ namespace IO.Swagger.Api
var path = "/store/order/{orderId}"; var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
@ -420,7 +428,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);

View File

@ -191,15 +191,16 @@ namespace IO.Swagger.Api
var path = "/user"; var path = "/user";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -210,7 +211,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
@ -230,15 +231,16 @@ namespace IO.Swagger.Api
var path = "/user"; var path = "/user";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -249,7 +251,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
@ -267,15 +269,16 @@ namespace IO.Swagger.Api
var path = "/user/createWithArray"; var path = "/user/createWithArray";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -286,7 +289,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
@ -306,15 +309,16 @@ namespace IO.Swagger.Api
var path = "/user/createWithArray"; var path = "/user/createWithArray";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -325,7 +329,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
@ -343,15 +347,16 @@ namespace IO.Swagger.Api
var path = "/user/createWithList"; var path = "/user/createWithList";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -362,7 +367,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
@ -382,15 +387,16 @@ namespace IO.Swagger.Api
var path = "/user/createWithList"; var path = "/user/createWithList";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -401,7 +407,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
@ -420,17 +426,18 @@ namespace IO.Swagger.Api
var path = "/user/login"; var path = "/user/login";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter pathParams.Add("format", "json");
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
@ -440,7 +447,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
@ -461,17 +468,18 @@ namespace IO.Swagger.Api
var path = "/user/login"; var path = "/user/login";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter pathParams.Add("format", "json");
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
@ -481,7 +489,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
@ -497,15 +505,16 @@ namespace IO.Swagger.Api
var path = "/user/logout"; var path = "/user/logout";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -515,7 +524,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
@ -534,15 +543,16 @@ namespace IO.Swagger.Api
var path = "/user/logout"; var path = "/user/logout";
path = path.Replace("{format}", "json");
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
@ -552,7 +562,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
@ -573,16 +583,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -592,7 +603,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
@ -614,16 +625,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -633,7 +645,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
@ -654,16 +666,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -674,7 +687,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
@ -697,16 +710,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -717,7 +731,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
@ -738,16 +752,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -757,7 +772,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
@ -779,16 +794,17 @@ namespace IO.Swagger.Api
var path = "/user/{username}"; var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username));
var pathParams = new Dictionary<String, String>();
var queryParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, FileParameter>(); var fileParams = new Dictionary<String, FileParameter>();
String postBody = null; String postBody = null;
pathParams.Add("format", "json");
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
@ -798,7 +814,7 @@ namespace IO.Swagger.Api
String[] authSettings = new String[] { }; String[] authSettings = new String[] { };
// make the HTTP request // make the HTTP request
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
if (((int)response.StatusCode) >= 400) if (((int)response.StatusCode) >= 400)
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content); throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);

View File

@ -50,23 +50,12 @@ namespace IO.Swagger.Client
get { return _defaultHeaderMap; } get { return _defaultHeaderMap; }
} }
/// <summary> // Creates and sets up a RestRequest prior to a call.
/// Makes the HTTP request (Sync). private RestRequest PrepareRequest(
/// </summary> String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
/// <param name="path">URL path.</param>
/// <param name="method">HTTP method.</param>
/// <param name="queryParams">Query parameters.</param>
/// <param name="postBody">HTTP body (POST request).</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param>
/// <param name="fileParams">File parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
/// <returns>Object</returns>
public Object CallApi(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams, Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, String[] authSettings) Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, String[] authSettings)
{ {
var request = new RestRequest(path, method); var request = new RestRequest(path, method);
UpdateParamsForAuth(queryParams, headerParams, authSettings); UpdateParamsForAuth(queryParams, headerParams, authSettings);
@ -75,6 +64,10 @@ namespace IO.Swagger.Client
foreach(var defaultHeader in _defaultHeaderMap) foreach(var defaultHeader in _defaultHeaderMap)
request.AddHeader(defaultHeader.Key, defaultHeader.Value); request.AddHeader(defaultHeader.Key, defaultHeader.Value);
// add path parameter, if any
foreach(var param in pathParams)
request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);
// add header parameter, if any // add header parameter, if any
foreach(var param in headerParams) foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value); request.AddHeader(param.Key, param.Value);
@ -94,8 +87,30 @@ namespace IO.Swagger.Client
if (postBody != null) // http body (model) parameter if (postBody != null) // http body (model) parameter
request.AddParameter("application/json", postBody, ParameterType.RequestBody); request.AddParameter("application/json", postBody, ParameterType.RequestBody);
return (Object)RestClient.Execute(request); return request;
}
/// <summary>
/// Makes the HTTP request (Sync).
/// </summary>
/// <param name="path">URL path.</param>
/// <param name="method">HTTP method.</param>
/// <param name="queryParams">Query parameters.</param>
/// <param name="postBody">HTTP body (POST request).</param>
/// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param>
/// <param name="fileParams">File parameters.</param>
/// <param name="pathParams">Path parameters.</param>
/// <param name="authSettings">Authentication settings.</param>
/// <returns>Object</returns>
public Object CallApi(
String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, String[] authSettings)
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
return (Object)RestClient.Execute(request);
} }
/// <summary> /// <summary>
@ -108,39 +123,16 @@ namespace IO.Swagger.Client
/// <param name="headerParams">Header parameters.</param> /// <param name="headerParams">Header parameters.</param>
/// <param name="formParams">Form parameters.</param> /// <param name="formParams">Form parameters.</param>
/// <param name="fileParams">File parameters.</param> /// <param name="fileParams">File parameters.</param>
/// <param name="pathParams">Path parameters.</param>
/// <param name="authSettings">Authentication settings.</param> /// <param name="authSettings">Authentication settings.</param>
/// <returns>The Task instance.</returns> /// <returns>The Task instance.</returns>
public async System.Threading.Tasks.Task<Object> CallApiAsync(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody, public async System.Threading.Tasks.Task<Object> CallApiAsync(
Dictionary<String, String> headerParams, Dictionary<String, String> formParams, Dictionary<String, FileParameter> fileParams, String[] authSettings) String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams, String[] authSettings)
{ {
var request = PrepareRequest(
var request = new RestRequest(path, method); path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
UpdateParamsForAuth(queryParams, headerParams, authSettings);
// add default header, if any
foreach(var defaultHeader in _defaultHeaderMap)
request.AddHeader(defaultHeader.Key, defaultHeader.Value);
// add header parameter, if any
foreach(var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
request.AddQueryParameter(param.Key, param.Value);
// add form parameter, if any
foreach(var param in formParams)
request.AddParameter(param.Key, param.Value);
// add file parameter, if any
foreach(var param in fileParams)
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
if (postBody != null) // http body (model) parameter
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
return (Object) await RestClient.ExecuteTaskAsync(request); return (Object) await RestClient.ExecuteTaskAsync(request);
} }

View File

@ -2,7 +2,7 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
<Files> <Files>
<File FileName="TestPet.cs" Line="28" Column="64" /> <File FileName="TestPet.cs" Line="68" Column="30" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>

View File

@ -45,7 +45,7 @@ namespace SwaggerClient.TestPet
{ {
// remove the pet after testing // remove the pet after testing
PetApi petApi = new PetApi (); PetApi petApi = new PetApi ();
petApi.DeletePet("test key", petId); petApi.DeletePet(petId, "test key");
} }

View File

@ -0,0 +1,112 @@
param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://www.newtonsoft.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
{
# user is installing from VS NuGet console
# get reference to the window, the console host and the input history
# show webpage if "install-package newtonsoft.json" was last input
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
if ($prop -eq $null) { return }
$hostInfo = $prop.GetValue($consoleWindow)
if ($hostInfo -eq $null) { return }
$history = $hostInfo.WpfConsole.InputHistory.History
$lastCommand = $history | select -last 1
if ($lastCommand)
{
$lastCommand = $lastCommand.Trim().ToLower()
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
else
{
# user is installing from VS NuGet dialog
# get reference to the window, then smart output console provider
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
[System.Reflection.BindingFlags]::NonPublic)
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
$instance = $instanceField.GetValue($null)
if ($instance -eq $null) { return }
$consoleProvider = $consoleField.GetValue($instance)
if ($consoleProvider -eq $null) { return }
$console = $consoleProvider.CreateOutputConsole($false)
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($messagesField -eq $null) { return }
$messages = $messagesField.GetValue($console)
if ($messages -eq $null) { return }
$operations = $messages -split "=============================="
$lastOperation = $operations | select -last 1
if ($lastOperation)
{
$lastOperation = $lastOperation.ToLower()
$lines = $lastOperation -split "`r`n"
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1
if ($installMatch)
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
}
catch
{
try
{
$pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
$selection = $pmPane.TextDocument.Selection
$selection.StartOfDocument($false)
$selection.EndOfDocument($true)
if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
catch
{
# stop potential errors from bubbling up
# worst case the splash page won't open
}
}
# still yolo

View File

@ -0,0 +1,22 @@
*** IMPORTANT CHANGE IN RESTSHARP VERSION 103 ***
In 103.0, JSON.NET was removed as a dependency.
If this is still installed in your project and no other libraries depend on
it you may remove it from your installed packages.
There is one breaking change: the default Json*Serializer* is no longer
compatible with Json.NET. To use Json.NET for serialization, copy the code
from https://github.com/restsharp/RestSharp/blob/86b31f9adf049d7fb821de8279154f41a17b36f7/RestSharp/Serializers/JsonSerializer.cs
and register it with your client:
var client = new RestClient();
client.JsonSerializer = new YourCustomSerializer();
The default Json*Deserializer* is mostly compatible, but it does not support
all features which Json.NET has (like the ability to support a custom [JsonConverter]
by decorating a certain property with an attribute). If you need these features, you
must take care of the deserialization yourself to get it working.
If you run into any compatibility issues with deserialization,
please report it to http://groups.google.com/group/restsharp