Example #1
0
        public static XboxProfile GetProfile()
        {
            string Endpoint       = "/account";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(new XboxProfile(Response));
        }
Example #2
0
        public static XboxProfile GetProfile(string Gamertag)
        {
            string Endpoint       = string.Format("/friends/search?gt={0}", Gamertag);
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(new XboxProfile(Response));
        }
Example #3
0
        public static string GetClips()
        {
            string Endpoint       = "/dvr/gameclips";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(Response);
        }
Example #4
0
        public static string GetAchievements()
        {
            string Endpoint       = "/achievements";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(Response);
        }
Example #5
0
        public static string GetHistory()
        {
            string Endpoint       = "/activity/history";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(Response);
        }
Example #6
0
        public static Friend GetSummary()
        {
            string Endpoint       = "/player/summary";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(new Friend(Response));
        }
Example #7
0
        public static Conversation GetConversation(string xuid)
        {
            string Endpoint       = string.Format("/conversations/{0}", xuid);
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = RestServices.GetResponse(RequestAddress, APIKEY);

            return(Conversation.DeserializeJSON(Response));
        }
Example #8
0
        public static IEnumerable <Friend> GetFriends()
        {
            string        Endpoint       = "/friends";
            Uri           RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string        Response       = RestServices.GetResponse(RequestAddress, APIKEY);
            List <JToken> tokens         = new List <JToken>(JObject.Parse(Response).SelectTokens("people"));

            foreach (JToken t in tokens.Children())
            {
                yield return(new Friend(Person.DeserializeJSON(t)));
            }
        }
Example #9
0
        public static IEnumerable <ConversationSummary> GetConversations()
        {
            string        Endpoint       = "/conversations";
            Uri           RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string        Response       = RestServices.GetResponse(RequestAddress, APIKEY);
            List <JToken> tokens         = new List <JToken>(JObject.Parse(Response).SelectTokens("results"));

            foreach (JToken t in tokens.Children())
            {
                yield return(ConversationSummary.DeserializeJSON(t));
            }
        }
Example #10
0
        public static IEnumerable <Alert> GetAlerts()
        {
            string        Endpoint       = "/alerts";
            Uri           RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string        Response       = RestServices.GetResponse(RequestAddress, APIKEY);
            List <JToken> tokens         = new List <JToken>(JObject.Parse(Response).SelectTokens("alerts"));
            List <Alert>  l = new List <Alert>();

            foreach (JToken t in tokens.Children())
            {
                yield return(Alert.DeserializeJSON(t));
            }
        }
Example #11
0
        public XboxProfile(ProfileUser User)
        {
            ID     = Convert.ToInt64(User.id);
            HostID = Convert.ToInt64(User.hostId);
            //SponsoredUser = User.isSponsoredUser;
            foreach (Setting s in User.settings)
            {
                switch (s.id)
                {
                case "GameDisplayPicRaw":
                    GamerPic = new Uri(s.value);
                    break;

                case "Gamerscore":
                    Gamerscore = Convert.ToInt32(s.value);
                    break;

                case "Gamertag":
                    Gamertag = s.value;
                    break;

                case "AccountTier":
                    AccountTier = s.value;
                    break;

                case "XboxOneRep":
                    Reputation = s.value;
                    break;

                case "PreferredColor":
                    string ColorJSON = RestServices.GetResponse(new Uri(s.value));
                    PreferredColor = PreferredColor.DeserializeJSON(ColorJSON);
                    break;

                case "RealName":
                    RealName = s.value;
                    break;

                case "Bio":
                    Bio = s.value;
                    break;

                case "Location":
                    Location = s.value;
                    break;

                default:
                    break;
                }
            }
        }
Example #12
0
 public static void RemoveFriend(string xuid)
 {
     string Endpoint       = string.Format("/friends/remove/{0}", xuid);
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = RestServices.GetResponse(RequestAddress, APIKEY);
 }