Skip to content

Commit 8cd3ea2

Browse files
authored
added xml comments and restrict some access (#22796)
1 parent a4985ca commit 8cd3ea2

144 files changed

Lines changed: 1056 additions & 144 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ namespace {{packageName}}.{{clientPackage}}
1616
/// <typeparam name="TTokenBase"></typeparam>
1717
{{>visibility}} class RateLimitProvider<TTokenBase> : TokenProvider<TTokenBase> where TTokenBase : TokenBase
1818
{
19-
public Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>>{{/net70OrLater}}();
19+
/// <summary>
20+
/// Dictionary mapping header names to channels of available tokens for rate limiting.
21+
/// Each channel buffers tokens that have become available and are ready for use.
22+
/// </summary>
23+
protected internal Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>>{{/net70OrLater}}();
2024

2125
/// <summary>
2226
/// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout.
@@ -85,7 +89,7 @@ namespace {{packageName}}.{{clientPackage}}
8589
}
8690

8791
/// <inheritdoc/>
88-
public override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}})
92+
protected internal override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}})
8993
{
9094
if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel<TTokenBase>{{nrt?}} tokens))
9195
throw new KeyNotFoundException($"Could not locate a token for header '{header}'.");

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ namespace {{packageName}}.{{clientPackage}}
1919
private readonly System.Timers.Timer _timer = new System.Timers.Timer();
2020
2121
internal TimeSpan? Timeout { get; set; }
22+
23+
/// <summary>
24+
/// Delegate for token availability notification events.
25+
/// </summary>
26+
/// <param name="sender">The token that became available.</param>
2227
public delegate void TokenBecameAvailableEventHandler(object sender);
28+
29+
/// <summary>
30+
/// Event raised when a rate-limited token becomes available for use.
31+
/// </summary>
2332
public event TokenBecameAvailableEventHandler{{nrt?}} TokenBecameAvailable;
2433

2534
/// <summary>

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenProvider`1.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ namespace {{packageName}}
1616
/// </summary>
1717
{{>visibility}} abstract class TokenProvider<TTokenBase> where TTokenBase : TokenBase
1818
{
19-
public abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}});
19+
/// <summary>
20+
/// Gets a token asynchronously for the specified header.
21+
/// </summary>
22+
/// <param name="header">The header name to retrieve a token for. Empty string for non-API-key authentication schemes.</param>
23+
/// <param name="cancellation">Cancellation token for the asynchronous operation.</param>
24+
/// <returns>A task that returns the requested token.</returns>
25+
protected internal abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}});
2026
}
2127
}

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client
2121
/// <typeparam name="TTokenBase"></typeparam>
2222
public class RateLimitProvider<TTokenBase> : TokenProvider<TTokenBase> where TTokenBase : TokenBase
2323
{
24-
public Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
24+
/// <summary>
25+
/// Dictionary mapping header names to channels of available tokens for rate limiting.
26+
/// Each channel buffers tokens that have become available and are ready for use.
27+
/// </summary>
28+
protected internal Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
2529

2630
/// <summary>
2731
/// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout.
@@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer<TTokenBase> container) : base()
4751
}
4852

4953
/// <inheritdoc/>
50-
public override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
54+
protected internal override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
5155
{
5256
if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel<TTokenBase>? tokens))
5357
throw new KeyNotFoundException($"Could not locate a token for header '{header}'.");

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ public abstract class TokenBase
2424
private readonly System.Timers.Timer _timer = new System.Timers.Timer();
2525

2626
internal TimeSpan? Timeout { get; set; }
27+
28+
/// <summary>
29+
/// Delegate for token availability notification events.
30+
/// </summary>
31+
/// <param name="sender">The token that became available.</param>
2732
public delegate void TokenBecameAvailableEventHandler(object sender);
33+
34+
/// <summary>
35+
/// Event raised when a rate-limited token becomes available for use.
36+
/// </summary>
2837
public event TokenBecameAvailableEventHandler? TokenBecameAvailable;
2938

3039
/// <summary>

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenProvider`1.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ namespace Org.OpenAPITools
2121
/// </summary>
2222
public abstract class TokenProvider<TTokenBase> where TTokenBase : TokenBase
2323
{
24-
public abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default);
24+
/// <summary>
25+
/// Gets a token asynchronously for the specified header.
26+
/// </summary>
27+
/// <param name="header">The header name to retrieve a token for. Empty string for non-API-key authentication schemes.</param>
28+
/// <param name="cancellation">Cancellation token for the asynchronous operation.</param>
29+
/// <returns>A task that returns the requested token.</returns>
30+
protected internal abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default);
2531
}
2632
}

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client
2121
/// <typeparam name="TTokenBase"></typeparam>
2222
public class RateLimitProvider<TTokenBase> : TokenProvider<TTokenBase> where TTokenBase : TokenBase
2323
{
24-
public Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
24+
/// <summary>
25+
/// Dictionary mapping header names to channels of available tokens for rate limiting.
26+
/// Each channel buffers tokens that have become available and are ready for use.
27+
/// </summary>
28+
protected internal Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
2529

2630
/// <summary>
2731
/// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout.
@@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer<TTokenBase> container) : base()
4751
}
4852

4953
/// <inheritdoc/>
50-
public override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
54+
protected internal override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
5155
{
5256
if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel<TTokenBase>? tokens))
5357
throw new KeyNotFoundException($"Could not locate a token for header '{header}'.");

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenBase.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ public abstract class TokenBase
2424
private readonly System.Timers.Timer _timer = new System.Timers.Timer();
2525

2626
internal TimeSpan? Timeout { get; set; }
27+
28+
/// <summary>
29+
/// Delegate for token availability notification events.
30+
/// </summary>
31+
/// <param name="sender">The token that became available.</param>
2732
public delegate void TokenBecameAvailableEventHandler(object sender);
33+
34+
/// <summary>
35+
/// Event raised when a rate-limited token becomes available for use.
36+
/// </summary>
2837
public event TokenBecameAvailableEventHandler? TokenBecameAvailable;
2938

3039
/// <summary>

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/TokenProvider`1.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ namespace Org.OpenAPITools
2121
/// </summary>
2222
public abstract class TokenProvider<TTokenBase> where TTokenBase : TokenBase
2323
{
24-
public abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default);
24+
/// <summary>
25+
/// Gets a token asynchronously for the specified header.
26+
/// </summary>
27+
/// <param name="header">The header name to retrieve a token for. Empty string for non-API-key authentication schemes.</param>
28+
/// <param name="cancellation">Cancellation token for the asynchronous operation.</param>
29+
/// <returns>A task that returns the requested token.</returns>
30+
protected internal abstract System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default);
2531
}
2632
}

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ namespace Org.OpenAPITools.Client
2121
/// <typeparam name="TTokenBase"></typeparam>
2222
public class RateLimitProvider<TTokenBase> : TokenProvider<TTokenBase> where TTokenBase : TokenBase
2323
{
24-
public Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
24+
/// <summary>
25+
/// Dictionary mapping header names to channels of available tokens for rate limiting.
26+
/// Each channel buffers tokens that have become available and are ready for use.
27+
/// </summary>
28+
protected internal Dictionary<string, global::System.Threading.Channels.Channel<TTokenBase>> AvailableTokens { get; } = new();
2529

2630
/// <summary>
2731
/// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout.
@@ -47,7 +51,7 @@ public RateLimitProvider(TokenContainer<TTokenBase> container) : base()
4751
}
4852

4953
/// <inheritdoc/>
50-
public override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
54+
protected internal override async System.Threading.Tasks.ValueTask<TTokenBase> GetAsync(string header = "", System.Threading.CancellationToken cancellation = default)
5155
{
5256
if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel<TTokenBase>? tokens))
5357
throw new KeyNotFoundException($"Could not locate a token for header '{header}'.");

0 commit comments

Comments
 (0)