You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
812 B
26 lines
812 B
4 years ago
|
using System;
|
||
|
|
||
|
namespace Discord.Net.Rest
|
||
|
{
|
||
|
public static class DefaultRestClientProvider
|
||
|
{
|
||
|
public static readonly RestClientProvider Instance = Create();
|
||
|
|
||
|
/// <exception cref="PlatformNotSupportedException">The default RestClientProvider is not supported on this platform.</exception>
|
||
|
public static RestClientProvider Create(bool useProxy = false)
|
||
|
{
|
||
|
return url =>
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new DefaultRestClient(url, useProxy);
|
||
|
}
|
||
|
catch (PlatformNotSupportedException ex)
|
||
|
{
|
||
|
throw new PlatformNotSupportedException("The default RestClientProvider is not supported on this platform.", ex);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|