コード例 #1
0
 public static async Task UnfavoriteFriendAsync(string xuid)
 {
     string Endpoint = "/friends/favorite/remove";
     //string Data = string.Format("{\"xuids\":[{0}]}", xuid);
     string Data           = "{\"xuids\":[" + xuid + "]}";
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = await RestServices.GetPostResponseAsync(RequestAddress, Data, APIKEY).ConfigureAwait(false);
 }
コード例 #2
0
 public static void UnfavoriteFriend(string xuid)
 {
     string Endpoint = "/friends/favorite/remove";
     //string Data = string.Format("{\"xuids\":[{0}]}", xuid);
     string Data           = "{\"xuids\":[" + xuid + "]}";
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = RestServices.GetPostResponse(RequestAddress, Data, APIKEY);
 }
コード例 #3
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));
        }
コード例 #4
0
 public static async Task SendMessageAsync(string Gamertag, string Message)
 {
     string Endpoint = "/conversations";
     //string Data = string.Format("{\"to\":\"{0}\",\"message\":\"{1}\"}", Gamertag, Message);
     string Data           = "{\"to\":\"" + Gamertag + "\",\"message\":\"" + Message + "\"}";
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = await RestServices.GetPostResponseAsync(RequestAddress, Data, APIKEY).ConfigureAwait(false);
 }
コード例 #5
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);
        }
コード例 #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));
        }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
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));
        }
コード例 #10
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));
        }
コード例 #11
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));
        }
コード例 #12
0
 public static void SendMessage(string Gamertag, string Message)
 {
     string Endpoint = "/conversations";
     //string Data = string.Format("{\"to\":\"{0}\",\"message\":\"{1}\"}", Gamertag, Message);
     string Data           = "{\"to\":\"" + Gamertag + "\",\"message\":\"" + Message + "\"}";
     Uri    RequestAddress = new Uri(string.Format("{0}{1}", BASEURI, Endpoint));
     string Response       = RestServices.GetPostResponse(RequestAddress, Data, APIKEY);
 }
コード例 #13
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));
        }
コード例 #14
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));
        }
コード例 #15
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));
        }
コード例 #16
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)));
            }
        }
コード例 #17
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));
            }
        }
コード例 #18
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));
            }
        }
コード例 #19
0
ファイル: XboxProfile.cs プロジェクト: Kalakoi/OpenXBL.NET
        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;
                }
            }
        }
コード例 #20
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);
        }
コード例 #21
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);
        }
コード例 #22
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);
 }
コード例 #23
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);
 }