diff --git a/src/Discord.Net.Rest/Net/HttpClientFactoryRestClientProvider.cs b/src/Discord.Net.Rest/Net/HttpClientFactoryRestClientProvider.cs new file mode 100644 index 000000000..3da937f6f --- /dev/null +++ b/src/Discord.Net.Rest/Net/HttpClientFactoryRestClientProvider.cs @@ -0,0 +1,25 @@ +using System; +using System.Net.Http; + +namespace Discord.Net.Rest +{ + public static class HttpClientFactoryRestClientProvider + { + + /// The default RestClientProvider is not supported on this platform. + public static RestClientProvider Create(HttpClient httpClient, bool useProxy = false) + { + return url => + { + try + { + return new HttpClientFactoryRestClient(url, httpClient, useProxy); + } + catch (PlatformNotSupportedException ex) + { + throw new PlatformNotSupportedException("The default RestClientProvider is not supported on this platform.", ex); + } + }; + } + } +}