Beispiel #1
0
        /// <summary>
        /// Retrieve the timeline of the current user from the Twitter API.
        /// Update the corresponding attribute if required by the parameter createTimeline.
        /// Return the timeline of the current user
        /// </summary>
        /// <param name="token">Token of the current user</param>
        /// <param name="wexDelegate">Handler of WebException thrown by the Twitter API</param>
        /// <param name="createTimeline">False by default. If true, the attribute _timeline is updated with the result</param>
        /// <returns>Null if the user token is null, the timeline of the user represented by the token otherwise</returns>
        private List <ITweet> GetUserTimeline(IToken token,
                                              WebExceptionHandlingDelegate wexDelegate = null,
                                              bool createTimeline = false)
        {
            token = GetQueryToken(token);

            if (token == null)
            {
                Console.WriteLine("Token must be specified");
                return(null);
            }

            List <ITweet> timeline = new List <ITweet>();

            ObjectResponseDelegate tweetDelegate = delegate(Dictionary <string, object> tweetContent)
            {
                Tweet t = new Tweet(tweetContent, _shareTokenWithChild ? _token : null);
                timeline.Add(t);
            };

            token.ExecuteSinceMaxQuery(String.Format(Resources.User_GetUserTimeline, Id), tweetDelegate, wexDelegate);

            if (createTimeline)
            {
                _timeline = timeline;
            }

            return(timeline);
        }