@@ -91,7 +91,7 @@ internal sealed class RestClient : IDisposable
91
91
/// </summary>
92
92
/// <param name="client">The client.</param>
93
93
internal RestClient ( BaseDiscordClient client )
94
- : this ( client . Configuration . Proxy , client . Configuration . HttpTimeout , client . Configuration . UseRelativeRatelimit , client . Logger )
94
+ : this ( client . Configuration , client . Logger )
95
95
{
96
96
this . _discord = client ;
97
97
@@ -109,14 +109,10 @@ internal RestClient(BaseDiscordClient client)
109
109
/// Initializes a new instance of the <see cref="RestClient" /> class.
110
110
/// This is for meta-clients, such as the <see cref="DiscordWebhookClient" /> and <see cref="DiscordOAuth2Client" />.
111
111
/// </summary>
112
- /// <param name="proxy">The proxy.</param>
113
- /// <param name="timeout">The timeout.</param>
114
- /// <param name="useRelativeRatelimit">Whether to use relative ratelimit.</param>
112
+ /// <param name="configuration">The configuration.</param>
115
113
/// <param name="logger">The logger.</param>
116
114
internal RestClient (
117
- IWebProxy ? proxy ,
118
- TimeSpan timeout ,
119
- bool useRelativeRatelimit ,
115
+ DiscordConfiguration configuration ,
120
116
ILogger logger
121
117
)
122
118
{
@@ -126,32 +122,32 @@ ILogger logger
126
122
{
127
123
UseCookies = false ,
128
124
AutomaticDecompression = DecompressionMethods . Deflate | DecompressionMethods . GZip ,
129
- UseProxy = proxy != null ,
130
- Proxy = proxy
125
+ UseProxy = configuration . Proxy != null ,
126
+ Proxy = configuration . Proxy
131
127
} ;
132
128
133
129
this . HttpClient = new ( httphandler )
134
130
{
135
- BaseAddress = new ( Utilities . GetApiBaseUri ( this . _discord ? . Configuration ) ) ,
136
- Timeout = timeout
131
+ BaseAddress = new ( Utilities . GetApiBaseUri ( configuration ) ) ,
132
+ Timeout = configuration . HttpTimeout
137
133
} ;
138
134
139
135
this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . USER_AGENT , Utilities . GetUserAgent ( ) ) ;
140
136
if ( this . _discord is { Configuration : not null } )
141
137
{
142
- this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . DISCORD_LOCALE , this . _discord . Configuration . Locale ) ;
143
- if ( ! string . IsNullOrWhiteSpace ( this . _discord . Configuration . Timezone ) )
144
- this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . DISCORD_TIMEZONE , this . _discord . Configuration . Timezone ) ;
145
- if ( ! string . IsNullOrWhiteSpace ( this . _discord . Configuration . Override ) )
146
- this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . SUPER_PROPERTIES , this . _discord . Configuration . Override ) ;
138
+ this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . DISCORD_LOCALE , configuration . Locale ) ;
139
+ if ( ! string . IsNullOrWhiteSpace ( configuration . Timezone ) )
140
+ this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . DISCORD_TIMEZONE , configuration . Timezone ) ;
141
+ if ( ! string . IsNullOrWhiteSpace ( configuration . Override ) )
142
+ this . HttpClient . DefaultRequestHeaders . TryAddWithoutValidation ( CommonHeaders . SUPER_PROPERTIES , configuration . Override ) ;
147
143
}
148
144
149
145
this . _routesToHashes = new ( ) ;
150
146
this . _hashesToBuckets = new ( ) ;
151
147
this . _requestQueue = new ( ) ;
152
148
153
149
this . _globalRateLimitEvent = new ( true ) ;
154
- this . _useResetAfter = useRelativeRatelimit ;
150
+ this . _useResetAfter = configuration . UseRelativeRatelimit ;
155
151
}
156
152
157
153
/// <summary>
0 commit comments