Commit graph

143 commits

Author SHA1 Message Date
stevenh
dee2c1a9f4 Refactored output processing to always return RestObject's
Refactored method names to be consistent with function e.g. Off -> ServerOff

Added new endpoints:-
/v2/server/status - Status query including player and rules matching common query tool requirements such as qstat. The json returned uses native types e.g. int's where possible
/v2/groups/list - Lists groups
/v2/groups/read - Query group detail
/v2/groups/destroy - Remove a group
/v2/groups/create - Create a group
/v2/players/list - Lists players including basic details
/v2/users/create - Create a user
/v2/users/list - Lists users basic user details applying a filter if specified.

Refactored missing parameter and error handling to use common utility methods RestError, RestMissingParam which ensures consistency across all functions and protects against null object references

Removed maxplayers from /status to ensure 100% compatibility, this and more details can be found in the new end point /v2/server/status

Protected against null names in user/activelist

Refactored variable checks to use string.IsNullOrWhiteSpace where applicable to capture errors early in the RestAPI

Added the ability to location users by "id" matching the underlying API.

Refactored locating players, bans & users to utility methods to ensure consitency across the api and eliminate duplicate code making for easier maintainence

NOTE: Duplicate and invalid DB entries currently can still be made if the DB format hasn't been updated to with missing unique and not null constaints

Removed { RequiresToken = true } from RestCommand constructors as this is the default anyway.

Optimised function calls so that tests are processed sequentially avoiding unnessasary operations in failure cases

Cleaned up formatting ensuring consistent line endings, indentation and single line if layout

Fixed ServerCommand duplicate key issue for multi line returns, now uses a single "response" string with embeded newlines

Fixed PlayerKill output using verb instead of parameters for "from" option
2012-02-16 12:03:08 +00:00
Lucas Nicodemus
6cb6e19f23 REST endpoint /lists/bans is now /v2/lists/bans
Added REST endpoint /v2/lists/players - JSON list of players
Deprecated REST endpoint /lists/players
2012-02-09 22:43:54 -07:00
Lucas Nicodemus
454403d495 Added /lists/bans REST endpoint - Returns a JSON list of bans 2012-02-09 22:20:36 -07:00
Lucas Nicodemus
5cdd537ebd /v2/players/kick no longer 500s if a player name isn't specified.
Fixes #361
2012-02-09 21:48:37 -07:00
Lucas Nicodemus
ee20946cdd REST endpoint /v2/users/activelist now null checks and works with 0 players.
Fixes #362
2012-02-09 21:43:35 -07:00
k0rd
16b3e51b4b (REST) add max slots to /status 2012-02-08 00:56:45 -05:00
Darkvengance aka Sildaekar
550e6b3685 Removed deperecated Rest API endpoints and updated UserListV2 method 2012-01-31 04:50:20 -06:00
Lucas Nicodemus
e17f56fae0 Added new REST endpoints:
- /v2/world/save
 -- Saves the world
 - /v2/world/autosave/state/{bool}
 -- Changes the autosave state of the server

TSHOCKPLUGINS-12
2012-01-07 14:15:08 -07:00
Deathmax
9297f2ef0d Add REST endpoint
v2 users list - tab-delimited
2012-01-07 19:34:27 +08:00
Deathmax
714746ab6c TSHOCKPLUGINS-9 #close fixed Fixed.
Workaround for REST meteor null reference exception crash. Requires an initializer for genRand if using any WorldGen methods in the future.
2012-01-06 21:58:51 +08:00
Lucas Nicodemus
d8e92e5ed0 Fixed 'shank forgot how to assign variables to an array' error on several rest calls. 2012-01-02 22:52:23 -07:00
Lucas Nicodemus
e8acdb0b96 Fixing some silly mistakes. 2012-01-02 22:39:04 -07:00
Lucas Nicodemus
be29a2cfcf Merge branch 'general-devel' of github.com:TShock/TShock into general-devel 2012-01-02 22:15:08 -07:00
Lucas Nicodemus
b8e4dffd74 Add new REST endpoint:
- /v2/server/rawcmd

Takes parameters:
 - cmd

Commands have to start with /, some commands aren't written properly, and may not return any more output than a status code.
2012-01-02 22:14:30 -07:00
Zack Piispanen
f82f05064a Added stack count to /v2/player/read 2012-01-02 16:42:55 -05:00
Lucas Nicodemus
f04b9d7a6d Remove test commit 2012-01-02 02:12:45 -07:00
Lucas Nicodemus
a7cc75082e Test commit 2012-01-02 02:11:49 -07:00
Lucas Nicodemus
4f07567eeb Add REST endpoints:
- /v2/players/mute
 - /v2/players/unmute
2012-01-02 02:07:19 -07:00
Lucas Nicodemus
e813ac8f87 Fix /v2/players/ban using verb instead of param (thanks @radishes) 2012-01-02 01:49:01 -07:00
Lucas Nicodemus
b9df823f41 Add the /v2/server/off endpoint 2012-01-02 00:57:03 -07:00
Lucas Nicodemus
0498d30b4e Add /v2/server/broadcast REST endpoint 2012-01-02 00:47:00 -07:00
Lucas Nicodemus
932dc9109c Added new REST endpoint:
- /v2/world/butcher
2012-01-02 00:33:27 -07:00
Lucas Nicodemus
f71d2c1a64 Add REST endpoint:
- /v2/players/kill
2012-01-02 00:13:26 -07:00
Lucas Nicodemus
62bc28332a Deprecating the following REST endpoints:
- /bans/read/{user}/info
 - /bans/destroy/{user}
 - /users/read/{user}/info
 - /users/destroy/{user}
 - /users/update/{user}

Adding replacement endpoints:
 - /v2/users/read
 - /v2/users/destroy
 - /v2/users/update
 - /v2/bans/read
 - /v2/bans/destroy
2012-01-01 16:44:45 -07:00
Lucas Nicodemus
3261fa40ef Deprecating the following REST API endpoints:
- /players/read/{player}
 - /players/{player}/kick
 - /players/{player}/ban

Adding the following REST API endpoints:
 - /v2/players/kick
 - /v2/players/ban
 - /v2/players/read
2012-01-01 16:25:24 -07:00
Lucas Nicodemus
640da9eefe Several REST endpoints that were incorrectly waiting on player parameters and 500ing without them now work as intended with the verb. 2012-01-01 16:14:59 -07:00
Lucas Nicodemus
bfc9ad98fb Fixed the REST kick endpoint expecting a player parameter as opposed to a verb 2012-01-01 15:55:48 -07:00
Lucas Nicodemus
bf9d0137f1 Added any missing license headers to all files 2012-01-01 03:06:48 -07:00
Lucas Nicodemus
4d5a0ed728 Added new REST function - /users/activelist - Gets the list of active, logged in user accounts, not player/character names. 2011-12-30 19:29:58 -07:00
Lucas Nicodemus
c6abbfe4d2 ReSharper code reformat to match naming conventions and stuff 2011-12-30 14:38:04 -07:00
Lucas Nicodemus
1147788154 ReSharper redundant code cleanup 2011-12-30 14:32:05 -07:00
Zidonuke
34efba9c1f Changed hack detection to allow future permissions overrides, now prevents hack clients modding max hp while online. 2011-12-28 21:03:29 -05:00
Lucas Nicodemus
8514140ca7 As per High's complaining, holocaust against the Tools class (now Utils)
Plugin developers: You really need to change to reference this.
2011-12-01 23:24:02 -07:00
high
a5550ad3f7 Fixed typo 2011-09-25 18:34:28 -04:00
Deathmax
cf1f283199 Add /players/{player}/ban 2011-09-17 11:45:18 +08:00
Deathmax
7a2ae6dbf9 Add /players/{player}/kick 2011-09-17 11:41:22 +08:00
Deathmax
e258f54212 Add /player/read/{player} 2011-09-16 22:36:36 +08:00
Deathmax
32f59e51c7 Change /world/read to use object instead of string
Removes .ToString's
2011-09-16 22:13:29 +08:00
high
da91d56513 Fixed geoip crashing on startup if geoip.dat is missing. Also fixed it crashing if you enable it without restarting tshock. 2011-09-05 22:07:51 -04:00
high
bedfc060e2 Changed Status/UserList to use linq and RestObject instead. 2011-09-05 21:52:41 -04:00
Lucas Nicodemus
ddd7329fbf Removed trailing commas from the lists of users 2011-09-05 19:36:44 -06:00
high
b7fd7f1953 Merge branch 'general-devel-rest' of github.com:TShock/TShock into general-devel-rest 2011-09-05 14:12:59 -04:00
Lucas Nicodemus
f87ff40260 Moved rest files around a bit 2011-09-05 12:09:23 -06:00
Renamed from TShockAPI/RestManager.cs (Browse further)