예제 #1
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
        /// <summary>
        /// Get friends timeline with full params
        /// </summary>
        public static IEnumerable <TwitterStatus> GetFriendsTimeline(this CredentialProvider provider, string id = null, long?sinceId = null, long?maxId = null, long?count = null, long?page = null)
        {
            List <KeyValuePair <string, string> > para = new List <KeyValuePair <string, string> >();

            if (sinceId != null && sinceId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("since_id", sinceId.Value.ToString()));
            }

            if (maxId != null && maxId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("max_id", maxId.Value.ToString()));
            }

            if (count != null)
            {
                para.Add(new KeyValuePair <string, string>("count", count.ToString()));
            }

            if (page != null)
            {
                para.Add(new KeyValuePair <string, string>("page", page.ToString()));
            }

            if (!String.IsNullOrEmpty(id))
            {
                para.Add(new KeyValuePair <string, string>("id", id.ToString()));
            }

            para.Add(new KeyValuePair <string, string>("include_entities", "true"));

            return(provider.GetTimeline("statuses/friends_timeline.json", para));
        }
예제 #2
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
        /// <summary>
        /// Get timeline with full parameters
        /// </summary>
        private static IEnumerable <TwitterStatus> GetTimeline(this CredentialProvider provider, string partialUri, long?sinceId, long?maxId, long?count, long?page, long?userId, string screenName)
        {
            List <KeyValuePair <string, string> > para = new List <KeyValuePair <string, string> >();

            if (sinceId != null && sinceId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("since_id", sinceId.Value.ToString()));
            }

            if (maxId != null && maxId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("max_id", maxId.Value.ToString()));
            }

            if (count != null)
            {
                para.Add(new KeyValuePair <string, string>("count", count.ToString()));
            }

            if (page != null)
            {
                para.Add(new KeyValuePair <string, string>("page", page.ToString()));
            }

            if (userId != null)
            {
                para.Add(new KeyValuePair <string, string>("user_id", userId.ToString()));
            }

            para.Add(new KeyValuePair <string, string>("include_entities", "true"));

            return(provider.GetTimeline(partialUri, para));
        }
예제 #3
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
        /// <summary>
        /// Get favorite timeline with full params
        /// </summary>
        public static IEnumerable <TwitterStatus> GetFavorites(this CredentialProvider provider, int count = 20)
        {
            var kvp = new List <KeyValuePair <string, string> >();

            kvp.Add(new KeyValuePair <string, string>("count", count.ToString()));
            return(provider.GetTimeline("favorites/list.json", kvp));
        }
예제 #4
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
        /// <summary>
        /// Get user timeline with full params
        /// </summary>
        public static IEnumerable <TwitterStatus> GetUserTimeline(this CredentialProvider provider, string id = null, long?userId = null, string screenName = null, long?sinceId = null, long?maxId = null, long?count = null, long?page = null, bool?trimUser = null, bool?includeRts = null)
        {
            List <KeyValuePair <string, string> > para = new List <KeyValuePair <string, string> >();

            if (sinceId != null && sinceId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("since_id", sinceId.Value.ToString()));
            }

            if (maxId != null && maxId.HasValue)
            {
                para.Add(new KeyValuePair <string, string>("max_id", maxId.Value.ToString()));
            }

            if (count != null)
            {
                para.Add(new KeyValuePair <string, string>("count", count.ToString()));
            }

            if (page != null)
            {
                para.Add(new KeyValuePair <string, string>("page", page.ToString()));
            }

            if (userId != null)
            {
                para.Add(new KeyValuePair <string, string>("user_id", userId.ToString()));
            }

            if (!String.IsNullOrEmpty(id))
            {
                para.Add(new KeyValuePair <string, string>("id", id.ToString()));
            }

            if (!String.IsNullOrEmpty(screenName))
            {
                para.Add(new KeyValuePair <string, string>("screen_name", screenName.ToString()));
            }

            if (trimUser != null)
            {
                para.Add(new KeyValuePair <string, string>("trim_user", "true"));
            }

            if (includeRts != null)
            {
                para.Add(new KeyValuePair <string, string>("include_rts", "true"));
            }

            para.Add(new KeyValuePair <string, string>("include_entities", "true"));

            return(provider.GetTimeline("statuses/user_timeline.json", para));
        }
예제 #5
0
파일: Listing.cs 프로젝트: a1lic/Mystique
        /// <summary>
        /// Get list statuses with full params
        /// </summary>
        public static IEnumerable <TwitterStatus> GetListStatuses(this CredentialProvider provider, string userScreenName, string listSlug, string sinceId = null, string maxId = null, long?perPage = null, bool?includeRts = null, bool?includeEntities = null)
        {
            listSlug = listSlug.Replace("_", "-");

            var para = new List <KeyValuePair <string, string> >();

            if (!String.IsNullOrEmpty(listSlug))
            {
                para.Add(new KeyValuePair <string, string>("slug", OAuth.UrlEncode(listSlug, Encoding.UTF8, true)));
            }

            if (!String.IsNullOrEmpty(userScreenName))
            {
                para.Add(new KeyValuePair <string, string>("owner_screen_name", userScreenName));
            }

            if (!String.IsNullOrEmpty(sinceId))
            {
                para.Add(new KeyValuePair <string, string>("since_id", sinceId));
            }

            if (!String.IsNullOrEmpty(maxId))
            {
                para.Add(new KeyValuePair <string, string>("max_id", maxId));
            }

            if (perPage != null)
            {
                para.Add(new KeyValuePair <string, string>("count", perPage.ToString()));
            }

            if (includeRts != null && includeRts.Value)
            {
                para.Add(new KeyValuePair <string, string>("include_rts", "true"));
            }

            if (includeEntities != null && includeEntities.Value)
            {
                para.Add(new KeyValuePair <string, string>("include_entities", "true"));
            }

            return(provider.GetTimeline("lists/statuses.json", para));
        }
예제 #6
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
 /// <summary>
 /// Get home timeline with full params (it contains following users' tweets)
 /// </summary>
 public static IEnumerable <TwitterStatus> GetHomeTimeline(this CredentialProvider provider, long?sinceId = null, long?maxId = null, long?count = null, long?page = null)
 {
     return(provider.GetTimeline("statuses/home_timeline.json", sinceId, maxId, count, page, null, null));
 }
예제 #7
0
파일: Timeline.cs 프로젝트: a1lic/Mystique
 /// <summary>
 /// Get public timeline<para />
 /// This result will caching while 60 seconds in Twitter server.
 /// </summary>
 /// <param name="provider">credential provider</param>
 public static IEnumerable <TwitterStatus> GetPublicTimeline(this CredentialProvider provider)
 {
     return(provider.GetTimeline("statuses/public_timeline.json", null, null, null, null, null, null));
 }