diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache index 14b0a1c574e..bafe525c00e 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/RateLimitProvider`1.mustache @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace {{packageName}}.{{clientPackage}} { @@ -17,7 +16,7 @@ namespace {{packageName}}.{{clientPackage}} /// {{>visibility}} class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary>{{/net70OrLater}}(); + internal Dictionary> AvailableTokens { get; } = new{{^net70OrLater}} Dictionary>{{/net70OrLater}}(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -29,12 +28,12 @@ namespace {{packageName}}.{{clientPackage}} token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); {{#lambda.copy}} - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); {{/lambda.copy}} {{#hasApiKeyMethods}} if (container is TokenContainer apiKeyTokenContainer) @@ -43,12 +42,12 @@ namespace {{packageName}}.{{clientPackage}} foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else @@ -64,14 +63,14 @@ namespace {{packageName}}.{{clientPackage}} {{/lambda.paste}} {{/hasApiKeyMethods}} - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}}) { - if (!AvailableTokens.TryGetValue(header, out Channel{{nrt?}} tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel{{nrt?}} tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 7537f0872a2..85504259655 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -24,7 +23,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -41,32 +40,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 53ad628a9a3..b2122290790 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 534f27a8cc5..3efb8651ab7 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 534f27a8cc5..3efb8651ab7 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index cddb8405886..899fc7a847e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 53ad628a9a3..b2122290790 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 534f27a8cc5..3efb8651ab7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 8e7bed46e9c..8f6aae1c258 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 534f27a8cc5..3efb8651ab7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index cddb8405886..899fc7a847e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -32,21 +31,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d50991f16ec..9d6ecd3bfdc 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index eb894eec841..4a06bcada3b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d5510735d39..9e2bdff2aa9 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -40,32 +39,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index eb894eec841..4a06bcada3b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d5510735d39..9e2bdff2aa9 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -40,32 +39,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 30ef4703319..27fbdab622a 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d50991f16ec..9d6ecd3bfdc 100644 --- a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index eb894eec841..4a06bcada3b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d5510735d39..9e2bdff2aa9 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -40,32 +39,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index b10d5ac58f5..67ce542f69e 100644 --- a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index eb894eec841..4a06bcada3b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index d5510735d39..9e2bdff2aa9 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -40,32 +39,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 30ef4703319..27fbdab622a 100644 --- a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -23,7 +22,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new(); + internal Dictionary> AvailableTokens { get; } = new(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -34,21 +33,21 @@ namespace Org.OpenAPITools.Client foreach(TTokenBase token in _tokens) token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel? tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs index 534f27a8cc5..3efb8651ab7 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Channels; namespace Org.OpenAPITools.Client { @@ -21,7 +20,7 @@ namespace Org.OpenAPITools.Client /// public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase { - internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); /// /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. @@ -38,32 +37,32 @@ namespace Org.OpenAPITools.Client foreach (string header in headers) { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(header, Channel.CreateBounded(options)); + AvailableTokens.Add(header, global::System.Threading.Channels.Channel.CreateBounded(options)); } } else { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) { - FullMode = BoundedChannelFullMode.DropWrite + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite }; - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); } - foreach(Channel tokens in AvailableTokens.Values) + foreach(global::System.Threading.Channels.Channel tokens in AvailableTokens.Values) for (int i = 0; i < _tokens.Length; i++) _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); } internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) { - if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false);