You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new constructor to Jikan class which accepts custom, user-provided HttpClient.
Reasoning
With this feature user will be able to provide custom HttpClient with preconfigured HttpMessageHandler, make HttpClient resilient with Polly for example etc.
Currently it is possible to achieve the same thing via reflection or with implementing IJikan interface and making such constructor, however both ways are looking tricky to me.
Proposed API
/// <summary>/// Constructor./// </summary>/// <param name="httpClient">Http client to call REST request and receive REST response</param>/// <param name="suppressException">Should exception be thrown in case of failed request. If true, failed request return null.</param>publicJikan(HttpClient httpClient, bool suppressException = false){_suppressException=suppressException;_httpClient=httpClient}
Optionally check httpClient instance for being null.
I can make a PR for this.
The text was updated successfully, but these errors were encountered:
Sounds reasonable, I'll add it. One disadvantage of that would be that user has to take care to prepare endpoint for HttpClient themselves - I think it should be documented.
Also when Jikan v4 will hit, next version will be probably tagged as 2.0 and have constructor reworked to avoid creating infinite combinations - probably one parameterless and second with object (maybe named JikanOptions or something similar).
Add new constructor to
Jikan
class which accepts custom, user-providedHttpClient
.Reasoning
With this feature user will be able to provide custom
HttpClient
with preconfigured HttpMessageHandler, makeHttpClient
resilient with Polly for example etc.Currently it is possible to achieve the same thing via reflection or with implementing
IJikan
interface and making such constructor, however both ways are looking tricky to me.Proposed API
Optionally check
httpClient
instance for being null.I can make a PR for this.
The text was updated successfully, but these errors were encountered: