Simplified Regions
This commit is contained in:
@@ -25,9 +25,9 @@ namespace Discord.API
|
|||||||
return Http.Post(Endpoints.AuthLogout, options);
|
return Http.Post(Endpoints.AuthLogout, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task CreateServer(string name, Region region, HttpOptions options)
|
public static Task CreateServer(string name, string region, HttpOptions options)
|
||||||
{
|
{
|
||||||
var request = new CreateServerRequest { Name = name, Region = RegionConverter.Convert(region) };
|
var request = new CreateServerRequest { Name = name, Region = region };
|
||||||
return Http.Post(Endpoints.Servers, request, options);
|
return Http.Post(Endpoints.Servers, request, options);
|
||||||
}
|
}
|
||||||
public static Task DeleteServer(string id, HttpOptions options)
|
public static Task DeleteServer(string id, HttpOptions options)
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ namespace Discord
|
|||||||
_isClosing = false;
|
_isClosing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task CreateServer(string name, Region region)
|
public Task CreateServer(string name, string region)
|
||||||
{
|
{
|
||||||
CheckReady();
|
CheckReady();
|
||||||
return DiscordAPI.CreateServer(name, region, _httpOptions);
|
return DiscordAPI.CreateServer(name, region, _httpOptions);
|
||||||
|
|||||||
@@ -1,32 +1,12 @@
|
|||||||
using System;
|
namespace Discord
|
||||||
|
|
||||||
namespace Discord
|
|
||||||
{
|
{
|
||||||
public enum Region
|
public static class Region
|
||||||
{
|
{
|
||||||
US_West,
|
public const string US_West = "us-west";
|
||||||
US_East,
|
public const string US_East = "us-east";
|
||||||
Singapore,
|
public const string Singapore = "singapore";
|
||||||
London,
|
public const string London = "london";
|
||||||
Sydney,
|
public const string Sydney = "sydney";
|
||||||
Amsterdam
|
public const string Amsterdam = "amsterdam";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class RegionConverter
|
|
||||||
{
|
|
||||||
public static string Convert(Region region)
|
|
||||||
{
|
|
||||||
switch (region)
|
|
||||||
{
|
|
||||||
case Region.US_West: return "us-west";
|
|
||||||
case Region.US_East: return "us-east";
|
|
||||||
case Region.Singapore: return "singapore";
|
|
||||||
case Region.London: return "london";
|
|
||||||
case Region.Sydney: return "sydney";
|
|
||||||
case Region.Amsterdam: return "amsterdam";
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException("Unknown server region");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user