Exemplo n.º 1
0
 /// <summary>
 /// Shows a user the list of users with whom they have a pending friend request    
 /// </summary>
 public static FourSquareUsers UserRequests(string AccessToken)
 {
     HTTPGet GET = new HTTPGet();
     string EndPoint = "https://api.foursquare.com/v2/users/requests" + "?callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
     GET.Request(EndPoint);
     Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
     FourSquareUsers UserRequests = new FourSquareUsers(JSONDictionary);
     return UserRequests;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Helps a user locate friends.   
        /// </summary>
        /// <param name="Phone">A comma-delimited list of phone numbers to look for.</param>
        /// <param name="EMail">A comma-delimited list of email addresses to look for.</param>
        /// <param name="Twitter">A comma-delimited list of Twitter handles to look for.</param>
        /// <param name="TwitterSource">A single Twitter handle. Results will be friends of this user who use Foursquare.</param>
        /// <param name="Fbid">A comma-delimited list of Facebook ID's to look for.</param>
        /// <param name="Name">A single string to search for in users' names</param>
        public static FourSquareUsers UserSearch(string Phone, string Email, string Twitter, string TwitterSource, string Fbid, string Name, string AccessToken)
        {
            HTTPGet GET = new HTTPGet();
            string Query = "";

            //Phone
            if (!Phone.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "phone=" + Phone;
            }

            //Email
            if (!Email.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "email=" + Email;
            }

            //Twitter
            if (!Twitter.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "twitter=" + Twitter;
            }

            //TwitterSource
            if (!TwitterSource.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "twitterSource=" + TwitterSource;
            }

            //Fbid
            if (!Fbid.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "fbid=" + Fbid;
            }

            //Name
            if (!Name.Equals(""))
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "name=" + Name;
            }

            string EndPoint = "https://api.foursquare.com/v2/users/search" + Query + "&callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
            GET.Request(EndPoint);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
            FourSquareUsers FoundUsers = new FourSquareUsers(JSONDictionary);
            return FoundUsers;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns an array of a user's friends. 
        /// </summary>
        /// <param name="USER_ID">Identity of the user to get friends of. Pass self to get friends of the acting user</param>
        /// <param name="Limit">Number of results to return, up to 500.</param>
        /// <param name="Offset">Used to page through results</param>
        public static FourSquareUsers UserFriends(string USER_ID, int Limit, int Offset, string AccessToken)
        {
            List<FourSquareUser> FriendUsers = new List<FourSquareUser>();

            string Query = "";

            if (USER_ID.Equals(""))
            {
                USER_ID = "self";
            }

            if (Limit > 0)
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "limit=" + Limit.ToString();
            }

            if (Offset > 0)
            {
                if (Query.Equals(""))
                {
                    Query = "?";
                }
                else
                {
                    Query += "&";
                }
                Query += "offset=" + Offset.ToString();
            }

            if (Query.Equals(""))
            {
                Query = "?";
            }
            else
            {
                Query += "&";
            }

            HTTPGet GET = new HTTPGet();
            string EndPoint = "https://api.foursquare.com/v2/users/" + USER_ID + "/friends" + Query + "callback=XXX&v=" + Version + "&oauth_token=" + AccessToken;
            GET.Request(EndPoint);
            Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody);
            FourSquareUsers Friends = new FourSquareUsers(JSONDictionary);
            return Friends;
        }