mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-21 08:29:08 +00:00
remove some static methods in configuration
This commit is contained in:
@@ -19,23 +19,56 @@ namespace {{packageName}}.Client
|
||||
public class ApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class.
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
||||
/// with default configuration and base path ({{basePath}}).
|
||||
/// </summary>
|
||||
public ApiClient()
|
||||
{
|
||||
Configuration = Configuration.Default;
|
||||
RestClient = new RestClient("{{basePath}}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
||||
/// with default base path ({{basePath}}).
|
||||
/// </summary>
|
||||
/// <param name="config">An instance of Configuration.</param>
|
||||
public ApiClient(Configuration config = null)
|
||||
{
|
||||
if (config == null)
|
||||
Configuration = Configuration.Default;
|
||||
else
|
||||
Configuration = config;
|
||||
|
||||
RestClient = new RestClient("{{basePath}}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class
|
||||
/// with default configuration.
|
||||
/// </summary>
|
||||
/// <param name="basePath">The base path.</param>
|
||||
public ApiClient(String basePath="{{basePath}}")
|
||||
public ApiClient(String basePath = "{{basePath}}")
|
||||
{
|
||||
if (String.IsNullOrEmpty(basePath))
|
||||
throw new ArgumentException("basePath cannot be empty");
|
||||
|
||||
RestClient = new RestClient(basePath);
|
||||
Configuration = Configuration.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default API client for making HTTP calls.
|
||||
/// </summary>
|
||||
/// <value>The default API client.</value>
|
||||
public static ApiClient Default = new ApiClient();
|
||||
public static ApiClient Default = new ApiClient(Configuration.Default);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Configuration.
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration.</value>
|
||||
public Configuration Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RestClient.
|
||||
/// </summary>
|
||||
|
||||
@@ -109,13 +109,13 @@ namespace {{packageName}}.Client
|
||||
return apiKeyValue;
|
||||
}
|
||||
|
||||
private static string _tempFolderPath = Path.GetTempPath();
|
||||
private string _tempFolderPath = Path.GetTempPath();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the temporary folder path to store the files downloaded from the server.
|
||||
/// </summary>
|
||||
/// <value>Folder path.</value>
|
||||
public static String TempFolderPath
|
||||
public String TempFolderPath
|
||||
{
|
||||
get { return _tempFolderPath; }
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace {{packageName}}.Client
|
||||
|
||||
private const string ISO8601_DATETIME_FORMAT = "o";
|
||||
|
||||
private static string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
|
||||
private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the the date time format used when serializing in the ApiClient
|
||||
@@ -151,7 +151,7 @@ namespace {{packageName}}.Client
|
||||
/// No validation is done to ensure that the string you're providing is valid
|
||||
/// </summary>
|
||||
/// <value>The DateTimeFormat string</value>
|
||||
public static String DateTimeFormat
|
||||
public String DateTimeFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user