mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 11:52:44 +00:00
refactor apiclient, configuration, authentication for c# client
This commit is contained in:
@@ -191,28 +191,30 @@ namespace IO.Swagger.Api
|
||||
/// </summary>
|
||||
public class PetApi : IPetApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PetApi"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
|
||||
/// <returns></returns>
|
||||
public PetApi(ApiClient apiClient = null)
|
||||
{
|
||||
if (apiClient == null) // use the default one in Configuration
|
||||
this.ApiClient = Configuration.DefaultApiClient;
|
||||
else
|
||||
this.ApiClient = apiClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PetApi"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PetApi(String basePath)
|
||||
{
|
||||
this.ApiClient = new ApiClient(basePath);
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
this.SetBasePath(basePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PetApi"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public PetApi(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
@@ -220,7 +222,7 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
this.ApiClient.BasePath = basePath;
|
||||
this.Configuration.ApiClient.BasePath = basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,15 +231,15 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.ApiClient.BasePath;
|
||||
return this.Configuration.ApiClient.BasePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the API client.
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the ApiClient</value>
|
||||
public ApiClient ApiClient {get; set;}
|
||||
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
@@ -261,9 +263,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -272,14 +274,21 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -311,9 +320,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -322,14 +331,21 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
@@ -359,9 +375,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -370,14 +386,21 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -409,9 +432,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -420,14 +443,21 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
@@ -457,32 +487,39 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
|
||||
if (status != null) queryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,29 +544,36 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
|
||||
if (status != null) queryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -554,32 +598,39 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
|
||||
if (tags != null) queryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -604,29 +655,36 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
|
||||
if (tags != null) queryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
return (List<Pet>) ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
return (List<Pet>) Configuration.ApiClient.Deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -654,32 +712,39 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "api_key" };
|
||||
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
var apiKeyValue = Configuration.GetApiKeyWithPrefix("api_key");
|
||||
if (!String.IsNullOrEmpty(apiKeyValue))
|
||||
{
|
||||
headerParams["api_key"] = apiKeyValue;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Pet) ApiClient.Deserialize(response, typeof(Pet));
|
||||
return (Pet) Configuration.ApiClient.Deserialize(response, typeof(Pet));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -706,29 +771,36 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "api_key" };
|
||||
|
||||
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
var apiKeyValue = Configuration.GetApiKeyWithPrefix("api_key");
|
||||
if (!String.IsNullOrEmpty(apiKeyValue))
|
||||
{
|
||||
headerParams["api_key"] = apiKeyValue;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
return (Pet) ApiClient.Deserialize(response, typeof(Pet));
|
||||
return (Pet) Configuration.ApiClient.Deserialize(response, typeof(Pet));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -758,27 +830,34 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
|
||||
if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
|
||||
if (name != null) formParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter
|
||||
if (status != null) formParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -814,27 +893,34 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
|
||||
if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
|
||||
if (name != null) formParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter
|
||||
if (status != null) formParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
@@ -868,26 +954,33 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
|
||||
if (apiKey != null) headerParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -922,26 +1015,33 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
|
||||
if (apiKey != null) headerParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
@@ -976,27 +1076,34 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
|
||||
if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file));
|
||||
if (additionalMetadata != null) formParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
|
||||
if (file != null) fileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file));
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -1032,27 +1139,34 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (petId != null) pathParams.Add("petId", ApiClient.ParameterToString(petId)); // path parameter
|
||||
if (petId != null) pathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter
|
||||
if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file));
|
||||
if (additionalMetadata != null) formParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter
|
||||
if (file != null) fileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file));
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "petstore_auth" };
|
||||
|
||||
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
|
||||
// oauth required
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
|
||||
@@ -99,28 +99,30 @@ namespace IO.Swagger.Api
|
||||
/// </summary>
|
||||
public class StoreApi : IStoreApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StoreApi"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
|
||||
/// <returns></returns>
|
||||
public StoreApi(ApiClient apiClient = null)
|
||||
{
|
||||
if (apiClient == null) // use the default one in Configuration
|
||||
this.ApiClient = Configuration.DefaultApiClient;
|
||||
else
|
||||
this.ApiClient = apiClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StoreApi"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public StoreApi(String basePath)
|
||||
{
|
||||
this.ApiClient = new ApiClient(basePath);
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
this.SetBasePath(basePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StoreApi"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public StoreApi(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
@@ -128,7 +130,7 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
this.ApiClient.BasePath = basePath;
|
||||
this.Configuration.ApiClient.BasePath = basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -137,15 +139,15 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.ApiClient.BasePath;
|
||||
return this.Configuration.ApiClient.BasePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the API client.
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the ApiClient</value>
|
||||
public ApiClient ApiClient {get; set;}
|
||||
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns pet inventories by status Returns a map of status codes to quantities
|
||||
@@ -168,9 +170,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -180,19 +182,26 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "api_key" };
|
||||
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
var apiKeyValue = Configuration.GetApiKeyWithPrefix("api_key");
|
||||
if (!String.IsNullOrEmpty(apiKeyValue))
|
||||
{
|
||||
headerParams["api_key"] = apiKeyValue;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Dictionary<string, int?>) ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
return (Dictionary<string, int?>) Configuration.ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -216,9 +225,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -228,16 +237,23 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { "api_key" };
|
||||
|
||||
|
||||
|
||||
// authentication (api_key) required
|
||||
|
||||
var apiKeyValue = Configuration.GetApiKeyWithPrefix("api_key");
|
||||
if (!String.IsNullOrEmpty(apiKeyValue))
|
||||
{
|
||||
headerParams["api_key"] = apiKeyValue;
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
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);
|
||||
|
||||
return (Dictionary<string, int?>) ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
return (Dictionary<string, int?>) Configuration.ApiClient.Deserialize(response, typeof(Dictionary<string, int?>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -262,9 +278,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -273,21 +289,20 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Order) ApiClient.Deserialize(response, typeof(Order));
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -312,9 +327,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -323,18 +338,17 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
return (Order) ApiClient.Deserialize(response, typeof(Order));
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -362,32 +376,31 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) pathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (Order) ApiClient.Deserialize(response, typeof(Order));
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -414,29 +427,28 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) pathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
return (Order) ApiClient.Deserialize(response, typeof(Order));
|
||||
return (Order) Configuration.ApiClient.Deserialize(response, typeof(Order));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -464,25 +476,24 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) pathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -516,25 +527,24 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (orderId != null) pathParams.Add("orderId", ApiClient.ParameterToString(orderId)); // path parameter
|
||||
if (orderId != null) pathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
|
||||
@@ -183,28 +183,30 @@ namespace IO.Swagger.Api
|
||||
/// </summary>
|
||||
public class UserApi : IUserApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserApi"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiClient"> an instance of ApiClient (optional)</param>
|
||||
/// <returns></returns>
|
||||
public UserApi(ApiClient apiClient = null)
|
||||
{
|
||||
if (apiClient == null) // use the default one in Configuration
|
||||
this.ApiClient = Configuration.DefaultApiClient;
|
||||
else
|
||||
this.ApiClient = apiClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserApi"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public UserApi(String basePath)
|
||||
{
|
||||
this.ApiClient = new ApiClient(basePath);
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
this.SetBasePath(basePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserApi"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public UserApi(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.DefaultConfiguration;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
@@ -212,7 +214,7 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
this.ApiClient.BasePath = basePath;
|
||||
this.Configuration.ApiClient.BasePath = basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -221,15 +223,15 @@ namespace IO.Swagger.Api
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.ApiClient.BasePath;
|
||||
return this.Configuration.ApiClient.BasePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the API client.
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the ApiClient</value>
|
||||
public ApiClient ApiClient {get; set;}
|
||||
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create user This can only be done by the logged in user.
|
||||
@@ -253,9 +255,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -264,14 +266,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -303,9 +304,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -314,14 +315,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
@@ -351,9 +351,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -362,14 +362,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -401,9 +400,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -412,14 +411,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
@@ -449,9 +447,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -460,14 +458,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -499,9 +496,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -510,14 +507,13 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
@@ -548,33 +544,32 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
|
||||
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
|
||||
if (username != null) queryParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // query parameter
|
||||
if (password != null) queryParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (string) ApiClient.Deserialize(response, typeof(string));
|
||||
return (string) Configuration.ApiClient.Deserialize(response, typeof(string));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -600,30 +595,29 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
|
||||
if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter
|
||||
if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter
|
||||
if (username != null) queryParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // query parameter
|
||||
if (password != null) queryParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // query parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
return (string) ApiClient.Deserialize(response, typeof(string));
|
||||
return (string) Configuration.ApiClient.Deserialize(response, typeof(string));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -647,9 +641,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -659,12 +653,11 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -695,9 +688,9 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
@@ -707,12 +700,11 @@ namespace IO.Swagger.Api
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
@@ -745,32 +737,31 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
return (User) ApiClient.Deserialize(response, typeof(User));
|
||||
return (User) Configuration.ApiClient.Deserialize(response, typeof(User));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -797,29 +788,28 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
return (User) ApiClient.Deserialize(response, typeof(User));
|
||||
return (User) Configuration.ApiClient.Deserialize(response, typeof(User));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -848,26 +838,25 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -902,26 +891,25 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
postBody = ApiClient.Serialize(body); // http body (model) parameter
|
||||
postBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
@@ -954,25 +942,24 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(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);
|
||||
@@ -1006,25 +993,24 @@ namespace IO.Swagger.Api
|
||||
String[] http_header_accepts = new String[] {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
|
||||
if (http_header_accept != null)
|
||||
headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));
|
||||
|
||||
// set "format" to json by default
|
||||
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||
pathParams.Add("format", "json");
|
||||
if (username != null) pathParams.Add("username", ApiClient.ParameterToString(username)); // path parameter
|
||||
if (username != null) pathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { };
|
||||
|
||||
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
IRestResponse response = (IRestResponse) await 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);
|
||||
|
||||
|
||||
@@ -64,12 +64,10 @@ namespace IO.Swagger.Client
|
||||
private RestRequest PrepareRequest(
|
||||
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)
|
||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams)
|
||||
{
|
||||
var request = new RestRequest(path, method);
|
||||
|
||||
UpdateParamsForAuth(queryParams, headerParams, authSettings);
|
||||
|
||||
// add default header, if any
|
||||
foreach(var defaultHeader in _defaultHeaderMap)
|
||||
request.AddHeader(defaultHeader.Key, defaultHeader.Value);
|
||||
@@ -111,15 +109,14 @@ namespace IO.Swagger.Client
|
||||
/// <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)
|
||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams)
|
||||
{
|
||||
var request = PrepareRequest(
|
||||
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
var response = RestClient.Execute(request);
|
||||
StatusCode = (int) response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
@@ -137,15 +134,14 @@ namespace IO.Swagger.Client
|
||||
/// <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>The Task instance.</returns>
|
||||
public async System.Threading.Tasks.Task<Object> CallApiAsync(
|
||||
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)
|
||||
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams)
|
||||
{
|
||||
var request = PrepareRequest(
|
||||
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
|
||||
path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
|
||||
var response = await RestClient.ExecuteTaskAsync(request);
|
||||
StatusCode = (int)response.StatusCode;
|
||||
ResponseHeaders = response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString());
|
||||
@@ -286,63 +282,6 @@ namespace IO.Swagger.Client
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
Configuration.ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
var apiKeyPrefix = "";
|
||||
if (Configuration.ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
|
||||
return apiKeyPrefix + " " + apiKeyValue;
|
||||
else
|
||||
return apiKeyValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update parameters based on authentication.
|
||||
/// </summary>
|
||||
/// <param name="queryParams">Query parameters.</param>
|
||||
/// <param name="headerParams">Header parameters.</param>
|
||||
/// <param name="authSettings">Authentication settings.</param>
|
||||
public void UpdateParamsForAuth(Dictionary<String, String> queryParams, Dictionary<String, String> headerParams, string[] authSettings)
|
||||
{
|
||||
if (authSettings == null || authSettings.Length == 0)
|
||||
return;
|
||||
|
||||
foreach (string auth in authSettings)
|
||||
{
|
||||
// determine which one to use
|
||||
switch(auth)
|
||||
{
|
||||
|
||||
case "api_key":
|
||||
|
||||
var apiKeyValue = GetApiKeyWithPrefix("api_key");
|
||||
if (!String.IsNullOrEmpty(apiKeyValue))
|
||||
{
|
||||
headerParams["api_key"] = apiKeyValue;
|
||||
}
|
||||
break;
|
||||
|
||||
case "petstore_auth":
|
||||
|
||||
if (!String.IsNullOrEmpty(Configuration.AccessToken))
|
||||
{
|
||||
headerParams["Authorization"] = "Bearer " + Configuration.AccessToken;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//show warning about security definition not found
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select the Accept header's value from the given accepts array:
|
||||
/// if JSON exists in the given array, use it;
|
||||
|
||||
@@ -23,37 +23,65 @@ namespace IO.Swagger.Client
|
||||
/// Gets or sets the default API client for making HTTP calls.
|
||||
/// </summary>
|
||||
/// <value>The API client.</value>
|
||||
public static ApiClient DefaultApiClient = new ApiClient();
|
||||
public static Configuration DefaultConfiguration = new Configuration();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default API client for making HTTP calls.
|
||||
/// </summary>
|
||||
/// <value>The API client.</value>
|
||||
public ApiClient ApiClient = new ApiClient();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the base path.
|
||||
/// </summary>
|
||||
/// <value>The base path.</value>
|
||||
public String BasePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the username (HTTP basic authentication).
|
||||
/// </summary>
|
||||
/// <value>The username.</value>
|
||||
public static String Username { get; set; }
|
||||
public String Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password (HTTP basic authentication).
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
public static String Password { get; set; }
|
||||
public String Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The access token.</value>
|
||||
public static String AccessToken { get; set; }
|
||||
public String AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the API key based on the authentication name.
|
||||
/// </summary>
|
||||
/// <value>The API key.</value>
|
||||
public static Dictionary<String, String> ApiKey = new Dictionary<String, String>();
|
||||
public Dictionary<String, String> ApiKey = new Dictionary<String, String>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
||||
/// </summary>
|
||||
/// <value>The prefix of the API key.</value>
|
||||
public static Dictionary<String, String> ApiKeyPrefix = new Dictionary<String, String>();
|
||||
public Dictionary<String, String> ApiKeyPrefix = new Dictionary<String, String>();
|
||||
|
||||
/// <summary>
|
||||
/// Get the API key with prefix.
|
||||
/// </summary>
|
||||
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
|
||||
/// <returns>API key with prefix.</returns>
|
||||
public string GetApiKeyWithPrefix (string apiKeyIdentifier)
|
||||
{
|
||||
var apiKeyValue = "";
|
||||
ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
|
||||
var apiKeyPrefix = "";
|
||||
if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
|
||||
return apiKeyPrefix + " " + apiKeyValue;
|
||||
else
|
||||
return apiKeyValue;
|
||||
}
|
||||
|
||||
private static string _tempFolderPath = Path.GetTempPath();
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user