From e929a9f5105c00b0a3a2b4e75a876bbb95bbfa7b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Jul 2017 21:30:04 -0400 Subject: Delete a LOT of obsolete code --- ShiftOS.Objects/UniteClient.cs | 236 ----------------------------------------- 1 file changed, 236 deletions(-) delete mode 100644 ShiftOS.Objects/UniteClient.cs (limited to 'ShiftOS.Objects/UniteClient.cs') diff --git a/ShiftOS.Objects/UniteClient.cs b/ShiftOS.Objects/UniteClient.cs deleted file mode 100644 index 8843930..0000000 --- a/ShiftOS.Objects/UniteClient.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using ShiftOS.Objects; - -namespace ShiftOS.Unite -{ - public class UniteClient - { - /// - /// Gets a string represents the user token for this Unite Client. - /// - public string Token { get; private set; } - - /// - /// Gets the base URL used in all API calls. Retrieved from the user's servers.json file. - /// - public string BaseURL - { - get - { - return ""; - } - } - - /// - /// Get the display name of a user. - /// - /// The user ID to look at. - /// - public string GetDisplayNameId(string id) - { - return MakeCall("/API/GetDisplayName/" + id); - } - - /// - /// Get the Pong highscore stats for all users. - /// - /// - public PongHighscoreModel GetPongHighscores() - { - return JsonConvert.DeserializeObject(MakeCall("/API/GetPongHighscores")); - } - - /// - /// Create a new instance of the object. - /// - /// Unused. - /// The user API token to use for this client (see http://getshiftos.ml/Manage and click "API" to see your tokens) - public UniteClient(string baseurl, string usertoken) - { - //Handled by the servers.json file - //BaseURL = baseurl; - Token = usertoken; - } - - /// - /// Make a call to the Unite API using the current user token and base URL. - /// - /// The path, relative to the base URL, to call. - /// The server's response. - internal string MakeCall(string url) - { - var webrequest = WebRequest.Create(BaseURL + url); - webrequest.Headers.Add("Authentication: Token " + Token); - using (var response = webrequest.GetResponse()) - { - using (var stream = response.GetResponseStream()) - { - using (var reader = new System.IO.StreamReader(stream)) - { - return reader.ReadToEnd(); - } - } - } - } - - /// - /// Get the Pong codepoint highscore for the current user. - /// - /// The amount of Codepoints returned by the server - public ulong GetPongCP() - { - return Convert.ToUInt64(MakeCall("/API/GetPongCP")); - } - - /// - /// Get the pong highest level score for this user - /// - /// The highest level the user has reached. - public int GetPongLevel() - { - return Convert.ToInt32(MakeCall("/API/GetPongLevel")); - } - - /// - /// Set the user's highest level record for Pong. - /// - /// The level to set the record to. - public void SetPongLevel(int value) - { - MakeCall("/API/SetPongLevel/" + value.ToString()); - } - - /// - /// Set the pong Codepoints record for the user - /// - /// The amount of Codepoints to set the record to - public void SetPongCP(ulong value) - { - MakeCall("/API/SetPongCP/" + value.ToString()); - } - - /// - /// Get the user's email address. - /// - /// The user's email address. - public string GetEmail() - { - return MakeCall("/API/GetEmail"); - } - - /// - /// Get the user's system name. - /// - /// The user's system name. - public string GetSysName() - { - return MakeCall("/API/GetSysName"); - } - - /// - /// Set the user's system name. - /// - /// The system name to set the record to. - public void SetSysName(string value) - { - MakeCall("/API/SetSysName/" + value); - } - - /// - /// Get the user's display name. - /// - /// The user's display name. - public string GetDisplayName() - { - return MakeCall("/API/GetDisplayName"); - } - - /// - /// Set the user's display name. - /// - /// The display name to set the user's account to. - public void SetDisplayName(string value) - { - MakeCall("/API/SetDisplayName/" + value.ToString()); - } - - /// - /// Get the user's full name if they have set it in their profile. - /// - /// Empty string if the user hasn't set their fullname, else, a string representing their fullname. - public string GetFullName() - { - return MakeCall("/API/GetFullName"); - } - - /// - /// Set the user's fullname. - /// - /// The new fullname. - public void SetFullName(string value) - { - MakeCall("/API/SetFullName/" + value.ToString()); - } - - /// - /// Get the user's codepoints. - /// - /// The amount of codepoints stored on the server for this user. - public ulong GetCodepoints() - { - return Convert.ToUInt64(MakeCall("/API/GetCodepoints")); - } - - /// - /// Set the user's codepoints. - /// - /// The amount of codepoints to set the user's codepoints value to. - public void SetCodepoints(ulong value) - { - MakeCall("/API/SetCodepoints/" + value.ToString()); - } - } - - /// - /// API data model for Unite pong highscores. - /// - public class PongHighscoreModel - { - /// - /// Amount of pages in this list. - /// - public int Pages { get; set; } - - /// - /// An array representing the highscores found on the server. - /// - public PongHighscore[] Highscores { get; set; } - } - - /// - /// API data model for a single Pong highscore. - /// - public class PongHighscore - { - /// - /// The user ID linked to this highscore. - /// - public string UserId { get; set; } - - /// - /// The highscore's level record. - /// - public int Level { get; set; } - - /// - /// The highscore's codepoint cashout record. - /// - public long CodepointsCashout { get; set; } - } -} -- cgit v1.2.3