-
-
Notifications
You must be signed in to change notification settings - Fork 315
build DiscordClient on top of IOC #1908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from comments; gonna open an issue wrt some tomfoolery happening regarding ratelimit handling
this.httpClient.BaseAddress = new Uri(Utilities.GetApiBaseUri()); | ||
this.httpClient.Timeout = timeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it'd be worthwhile to go the Remora route and expose a [rest] client builder; there's occasional reason to change what the client does (e.g., adding additional polly handlers for metrics, or using the canary api for one reason or another)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Client builder as in Action<HttpClient>
parameter)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is something we should look into in a separate pull request to customize specifically rest further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is okay? Regardless please write a migration guide for this PR specifically. Before we release v5, we'll merge the migration guide for this PR and all other breaking changes into one. I just want a guide to reference right now since I myself don't particularly understand what the intended use is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursory glance (namely because of a jumble of a diff), but LGTM.
@OoLunar added the migration guide as requested |
* centralize the service provider * prepare the rest client for IOC * obsolete all the old events... * obsolete SocketErrored even more * enables registering event handlers to the service collection * fix event-related build errors * make DiscordApiClient IOC-constructible * death (migrate events (not dispatch yet) to the interim model) * update DiscordClient.Dipshit.cs * fix most trivial build errors * more progress towards usability * DSharpPlus.dll should now work:tm: * build? * miser, miser * add public construction code * update docs * convenience * details * migration guide (partial, only as far as this PR is concerned) * build * switch to CreateDefault * nit
current status:
non-goals of this PR:
leave issues for any other features associated with this you may want
closes #1683
makes progress towards #1820