Exemplo n.º 1
0
        /// <summary>
        /// Function that execute cursor query and send information for each query executed
        /// </summary>
        /// <param name="token"></param>
        static void ExecuteCursorQuery(Token token)
        {
            // The delegate is a function that will be called for each cursor
            Token.DynamicResponseDelegate del = delegate(dynamic jsonResponse, long previous_cursor, long next_cursor)
            {
                Console.WriteLine(previous_cursor + " -> " + next_cursor + " : " + jsonResponse.Count);
            };

            token.ExecuteCursorQuery("https://api.twitter.com/1/friends/ids.json?user_id=700562792", del);
        }
Exemplo n.º 2
0
        public List <long> getFollowers(Token token, bool createFollowerList = false, long cursor = 0)
        {
            if (token == null)
            {
                return(null);
            }

            if (cursor == 0)
            {
                Follower_ids = new List <long>();
                Followers    = new List <User>();
            }

            Token.DynamicResponseDelegate del = delegate(dynamic responseObject, long previous_cursor, long next_cursor)
            {
                foreach (var follower_id in responseObject["ids"])
                {
                    Follower_ids.Add((long)follower_id);
                    if (createFollowerList)
                    {
                        Followers.Add(new User((long)follower_id));
                    }
                }
            };

            if (id != null)
            {
                token.ExecuteCursorQuery(String.Format(query_user_followers, id), del);
            }
            else
            if (_screen_name != null)
            {
                token.ExecuteCursorQuery(String.Format(query_user_followers_from_name, screen_name), del);
            }

            return(Follower_ids);
        }