Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[csharp] Address MaxTimeout obsolete build warning #19875

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/utils/test_file_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
sha256: e323c7e646a0ceb6d1d8f34f287175ac666fdbbe057791b45d138de3d9582666
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
sha256: 7dad88554fe630d25c787cae05305d302d5e34ca810aee4fa23f20055f9188e1
sha256: b98a6043573332de4f049db50b36bce7b5fada8511769da97f6561066a0f8c5c
- filename: "samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/linux-logo.png"
sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230
# java okhttp gson test files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ namespace {{packageName}}.Client
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace {{packageName}}.Client
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -286,9 +286,9 @@ namespace {{packageName}}.Client
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ namespace {{packageName}}.Client
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ namespace {{packageName}}.Client

try
{
if (configuration.Timeout > 0)
if (configuration.Timeout > TimeSpan.Zero)
{
timeoutTokenSource = new CancellationTokenSource(configuration.Timeout);
finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -221,9 +221,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -215,9 +215,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void GetPetByIdTest()
{
// set timeout to 10 seconds
Configuration c1 = new Configuration();
c1.Timeout = 10000;
c1.Timeout = TimeSpan.FromSeconds(10);
c1.UserAgent = "TEST_USER_AGENT";

HttpClient httpClient = new HttpClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public PetApiTestsV2()
_petApi = new PetApi(_httpClient, new Configuration
{
BasePath = BasePath,
Timeout = 10000,
Timeout = TimeSpan.FromSeconds(10),
UserAgent = "TEST_USER_AGENT"
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ private async Task<ApiResponse<T>> ExecAsync<T>(HttpRequestMessage req,

try
{
if (configuration.Timeout > 0)
if (configuration.Timeout > TimeSpan.Zero)
{
timeoutTokenSource = new CancellationTokenSource(configuration.Timeout);
finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -315,9 +315,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -216,9 +216,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if users call the getter of Timeout in their code, they will need to update their code accordingly updating the C# client to a newer version including this change, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, if they use the 7.10.0 version of the generator to generate their client, they will need to update usages of Timeout.


/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -321,9 +321,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -321,9 +321,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public Configuration()
};

// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
Timeout = TimeSpan.FromSeconds(100);
}

/// <summary>
Expand Down Expand Up @@ -220,9 +220,9 @@ public virtual IDictionary<string, string> DefaultHeader
public virtual IDictionary<string, string> DefaultHeaders { get; set; }

/// <summary>
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual int Timeout { get; set; }
public virtual TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets the proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public interface IReadableConfiguration
string TempFolderPath { get; }

/// <summary>
/// Gets the HTTP connection timeout (in milliseconds)
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
int Timeout { get; }
TimeSpan Timeout { get; }

/// <summary>
/// Gets the proxy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<Rest
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
Expand Down
Loading
Loading