aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/UniteClient.cs
diff options
context:
space:
mode:
authorAShifter <[email protected]>2017-05-01 13:37:48 -0600
committerAShifter <[email protected]>2017-05-01 13:37:48 -0600
commitd30eb35c9755cf430efa124a9a2576ab6b74c8da (patch)
treebbf4c161697b390a96af01a36277c8dc4e52e1a0 /ShiftOS_TheReturn/UniteClient.cs
parentb842c73b04fb92d9ecaf3d8fcc2df6157c2e8652 (diff)
parent7532df70757ecbcaf735a5fc50eee282f555741a (diff)
downloadshiftos_thereturn-d30eb35c9755cf430efa124a9a2576ab6b74c8da.tar.gz
shiftos_thereturn-d30eb35c9755cf430efa124a9a2576ab6b74c8da.tar.bz2
shiftos_thereturn-d30eb35c9755cf430efa124a9a2576ab6b74c8da.zip
Merge remote-tracking branch 'refs/remotes/shiftos-game/master'
Diffstat (limited to 'ShiftOS_TheReturn/UniteClient.cs')
-rw-r--r--ShiftOS_TheReturn/UniteClient.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/UniteClient.cs b/ShiftOS_TheReturn/UniteClient.cs
new file mode 100644
index 0000000..88e44af
--- /dev/null
+++ b/ShiftOS_TheReturn/UniteClient.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Unite
+{
+ public class UniteClient
+ {
+ public string Token { get; private set; }
+ public string BaseURL { get; private set; }
+
+ public UniteClient(string baseurl, string usertoken)
+ {
+ BaseURL = baseurl;
+ Token = usertoken;
+ }
+
+ 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();
+ }
+ }
+ }
+ }
+
+ public string GetEmail()
+ {
+ return MakeCall("/API/GetEmail");
+ }
+
+ public string GetSysName()
+ {
+ return MakeCall("/API/GetSysName");
+ }
+
+ public void SetSysName(string value)
+ {
+ MakeCall("/API/SetSysName/" + value);
+ }
+
+ public string GetDisplayName()
+ {
+ return MakeCall("/API/GetDisplayName");
+ }
+
+ public void SetDisplayName(string value)
+ {
+ MakeCall("/API/SetDisplayName/" + value.ToString());
+ }
+
+ public string GetFullName()
+ {
+ return MakeCall("/API/GetFullName");
+ }
+
+ public void SetFullName(string value)
+ {
+ MakeCall("/API/SetFullName/" + value.ToString());
+ }
+
+
+ public long GetCodepoints()
+ {
+ return Convert.ToInt64(MakeCall("/API/GetCodepoints"));
+ }
+
+ public void SetCodepoints(long value)
+ {
+ MakeCall("/API/SetCodepoints/" + value.ToString());
+ }
+ }
+}