Added /lists/bans REST endpoint - Returns a JSON list of bans

This commit is contained in:
Lucas Nicodemus 2012-02-09 22:20:36 -07:00
parent 5cdd537ebd
commit 454403d495
2 changed files with 32 additions and 0 deletions

View file

@ -48,6 +48,7 @@ namespace TShockAPI
Rest.Register(new RestCommand("/v2/bans/read", BanInfoV2) { RequiresToken = true });
Rest.Register(new RestCommand("/v2/bans/destroy", BanDestroyV2) { RequiresToken = true });
Rest.Register(new RestCommand("/lists/bans", BanListIPs) { RequiresToken = true });
Rest.Register(new RestCommand("/lists/players", PlayerList) {RequiresToken = true});
Rest.Register(new RestCommand("/world/read", WorldRead) {RequiresToken = true});
@ -252,6 +253,14 @@ namespace TShockAPI
#region RestBanMethods
private object BanListIPs(RestVerbs verbs, IParameterCollection parameters)
{
RestObject returnItem = new RestObject("200");
returnItem.Add("bans", TShock.Bans.GetBans());
return returnItem;
}
private object BanCreate(RestVerbs verbs, IParameterCollection parameters)
{
var returnBlock = new Dictionary<string, string>();