示例#1
0
        public static async Task <XboxProfile> GetProfileAsync(string Gamertag)
        {
            string Endpoint       = string.Format("/friends/search?gt={0}", Gamertag);
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            return(new XboxProfile(Response));
        }
示例#2
0
        public static async Task <XboxProfile> GetProfileAsync()
        {
            string Endpoint       = "/account";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            return(new XboxProfile(Response));
        }
示例#3
0
        public static async Task <Friend> GetSummaryAsync()
        {
            string Endpoint       = "/player/summary";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            return(new Friend(Response));
        }
示例#4
0
        public static async Task <Conversation> GetConversationAsync(string xuid)
        {
            string Endpoint       = string.Format("/conversations/{0}", xuid);
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            return(Conversation.DeserializeJSON(Response));
        }
示例#5
0
        public static async Task <List <Friend> > GetFriendsAsync()
        {
            string Endpoint       = "/friends";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            List <Friend> Return = new List <Friend>();
            List <JToken> tokens = new List <JToken>(JObject.Parse(Response).SelectTokens("people"));

            foreach (JToken t in tokens.Children())
            {
                Return.Add(new Friend(Person.DeserializeJSON(t)));
            }
            return(Return);
        }
示例#6
0
        public static async Task <List <Alert> > GetAlertsAsync()
        {
            string Endpoint       = "/alerts";
            Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
            string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);

            List <JToken> tokens = new List <JToken>(JObject.Parse(Response).SelectTokens("alerts"));
            List <Alert>  l      = new List <Alert>();

            foreach (JToken t in tokens.Children())
            {
                l.Add(Alert.DeserializeJSON(t));
            }
            return(l);
        }
示例#7
0
 public static async Task RemoveFriendAsync(string xuid)
 {
     string Endpoint       = string.Format("/friends/remove/{0}", xuid);
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = await RestServices.GetResponseAsync(RequestAddress, APIKEY).ConfigureAwait(false);
 }