forked from loafle/openapi-generator-original
add constructor to configuration
This commit is contained in:
parent
f03bc1f3bc
commit
b01b414aae
@ -12,6 +12,45 @@ namespace {{packageName}}.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Configuration
|
public class Configuration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the Configuration class with different settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiClient">Api client</param>
|
||||||
|
/// <param name="defaultHeader">Dictionary of default HTTP header</param>
|
||||||
|
/// <param name="username">Username</param>
|
||||||
|
/// <param name="password">Password</param>
|
||||||
|
/// <param name="accessToken">accessToken</param>
|
||||||
|
/// <param name="apiKey">Dictionary of API key</param>
|
||||||
|
/// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
|
||||||
|
/// <param name="tempFolderPath">Temp folder path</param>
|
||||||
|
/// <param name="dateTimeFormat">DateTime format string</param>
|
||||||
|
public Configuration(ApiClient apiClient,
|
||||||
|
Dictionary<String, String> defaultHeader,
|
||||||
|
string username,
|
||||||
|
string password,
|
||||||
|
string accessToken,
|
||||||
|
Dictionary<String, String> apiKey,
|
||||||
|
Dictionary<String, String> apiKeyPrefix,
|
||||||
|
string tempFolderPath,
|
||||||
|
string dateTimeFormat
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (apiClient == null)
|
||||||
|
ApiClient = ApiClient.Default;
|
||||||
|
else
|
||||||
|
ApiClient = apiClient;
|
||||||
|
|
||||||
|
Username = username;
|
||||||
|
Password = password;
|
||||||
|
AccessToken = accessToken;
|
||||||
|
ApiKey = apiKey;
|
||||||
|
ApiKeyPrefix = apiKeyPrefix;
|
||||||
|
|
||||||
|
TempFolderPath = tempFolderPath;
|
||||||
|
DateTimeFormat = dateTimeFormat;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the Configuration class.
|
/// Initializes a new instance of the Configuration class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -12,11 +12,53 @@ namespace IO.Swagger.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Configuration
|
public class Configuration
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the Configuration class with different settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiClient">Api client</param>
|
||||||
|
/// <param name="defaultHeader">Dictionary of default HTTP header</param>
|
||||||
|
/// <param name="username">Username</param>
|
||||||
|
/// <param name="password">Password</param>
|
||||||
|
/// <param name="accessToken">accessToken</param>
|
||||||
|
/// <param name="apiKey">Dictionary of API key</param>
|
||||||
|
/// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
|
||||||
|
/// <param name="tempFolderPath">Temp folder path</param>
|
||||||
|
/// <param name="dateTimeFormat">DateTime format string</param>
|
||||||
|
public Configuration(ApiClient apiClient = null,
|
||||||
|
Dictionary<String, String> defaultHeader = null,
|
||||||
|
string username = null,
|
||||||
|
string password = null,
|
||||||
|
string accessToken = null,
|
||||||
|
Dictionary<String, String> apiKey = null,
|
||||||
|
Dictionary<String, String> apiKeyPrefix = null,
|
||||||
|
string tempFolderPath = null,
|
||||||
|
string dateTimeFormat = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (apiClient == null)
|
||||||
|
ApiClient = ApiClient.Default;
|
||||||
|
else
|
||||||
|
ApiClient = apiClient;
|
||||||
|
|
||||||
|
Username = username;
|
||||||
|
Password = password;
|
||||||
|
AccessToken = accessToken;
|
||||||
|
|
||||||
|
if (apiKey != null)
|
||||||
|
ApiKey = apiKey;
|
||||||
|
if (apiKeyPrefix != null)
|
||||||
|
ApiKeyPrefix = apiKeyPrefix;
|
||||||
|
|
||||||
|
TempFolderPath = tempFolderPath;
|
||||||
|
DateTimeFormat = dateTimeFormat;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the Configuration class.
|
/// Initializes a new instance of the Configuration class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="apiClient">Api client.</param>
|
/// <param name="apiClient">Api client.</param>
|
||||||
public Configuration(ApiClient apiClient=null)
|
public Configuration(ApiClient apiClient)
|
||||||
{
|
{
|
||||||
if (apiClient == null)
|
if (apiClient == null)
|
||||||
ApiClient = ApiClient.Default;
|
ApiClient = ApiClient.Default;
|
||||||
|
@ -55,6 +55,15 @@ namespace SwaggerClientTest.TestConfiguration
|
|||||||
Assert.AreEqual("u", Configuration.Default.DateTimeFormat);
|
Assert.AreEqual("u", Configuration.Default.DateTimeFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestConstructor()
|
||||||
|
{
|
||||||
|
Configuration c = new Configuration (username: "test username", password: "test password");
|
||||||
|
Assert.AreEqual (c.Username, "test username");
|
||||||
|
Assert.AreEqual (c.Password, "test password");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[Test ()]
|
[Test ()]
|
||||||
public void TestDefautlConfiguration ()
|
public void TestDefautlConfiguration ()
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user