// Helpers private IEnumerable <long> ExecuteGetUserIdsQuery(string query, int maxUserIds) { var userIdsDTO = _twitterAccessor.ExecuteCursorGETQuery <IIdsCursorQueryResultDTO>(query, maxUserIds); if (userIdsDTO == null) { return(null); } var userIdsDTOList = userIdsDTO.ToList(); var userdIds = new List <long>(); for (int i = 0; i < userIdsDTOList.Count - 1; ++i) { userdIds.AddRange(userIdsDTOList.ElementAt(i).Ids); } // TODO : Move the limit logic in the TwitterAccessor.ExecuteCursorQuery if (userIdsDTOList.Any()) { var userIdsDTOResult = userIdsDTOList.Last(); userdIds.AddRange(userIdsDTOResult.Ids.Take(maxUserIds - userdIds.Count)); } return(userdIds); }
public static IEnumerable <T> ExecuteCursorGETQuery <T>( string query, int maxObjectToRetrieve = Int32.MaxValue, long cursor = -1) where T : class, IBaseCursorQueryDTO { return(_twitterAccessor.ExecuteCursorGETQuery <T>(query, maxObjectToRetrieve, cursor)); }
public IEnumerable <long> GetUserIdsRequestingFriendship() { string query = _friendshipQueryGenerator.GetUserIdsRequestingFriendshipQuery(); var userIdsDTO = _twitterAccessor.ExecuteCursorGETQuery <IIdsCursorQueryResultDTO>(query); if (userIdsDTO == null) { return(null); } var userIdsDTOList = userIdsDTO.ToList(); var userdIds = new List <long>(); for (int i = 0; i < userIdsDTOList.Count; ++i) { userdIds.AddRange(userIdsDTOList.ElementAt(i).Ids); } return(userdIds); }
public IEnumerable <IUserDTO> GetMembersOfList(IListIdentifier identifier, int maxNumberOfUsersToRetrieve) { string query = _listsQueryGenerator.GetMembersFromListQuery(identifier); var usersCursorQueryResults = _twitterAccessor.ExecuteCursorGETQuery <IUserCursorQueryResultDTO>(query, maxNumberOfUsersToRetrieve); if (usersCursorQueryResults == null) { return(null); } return(usersCursorQueryResults.SelectMany(x => x.Users)); }
// Friend ids public IEnumerable <long> GetFriendIds(IUserIdentifier user, int maxFriendsToRetrieve) { string query = _userQueryGenerator.GetFriendIdsQuery(user, maxFriendsToRetrieve); return(_twitterAccessor.ExecuteCursorGETQuery <long, IIdsCursorQueryResultDTO>(query, maxFriendsToRetrieve)); }
public IEnumerable <long> GetRetweetersIds(ITweetIdentifier tweetIdentifier, int maxRetweetersToRetrieve) { var query = _tweetQueryGenerator.GetRetweeterIdsQuery(tweetIdentifier, maxRetweetersToRetrieve); return(_twitterAccessor.ExecuteCursorGETQuery <long, IIdsCursorQueryResultDTO>(query)); }
public IEnumerable <long> GetUserIdsRequestingFriendship(int maximumUserIdsToRetrieve) { string query = _friendshipQueryGenerator.GetUserIdsRequestingFriendshipQuery(); return(_twitterAccessor.ExecuteCursorGETQuery <long, IIdsCursorQueryResultDTO>(query, maximumUserIdsToRetrieve)); }
// Mute public IEnumerable <long> GetMutedUserIds(int maxUserIds = Int32.MaxValue) { string query = _accountQueryGenerator.GetMutedUserIdsQuery(); return(_twitterAccessor.ExecuteCursorGETQuery <long, IIdsCursorQueryResultDTO>(query, maxUserIds)); }
// Owned Lists public IEnumerable <ITwitterListDTO> GetUserOwnedLists(IUserIdentifier user, int maximumNumberOfListsToRetrieve) { var baseQuery = _listsQueryGenerator.GetUsersOwnedListQuery(user, maximumNumberOfListsToRetrieve); return(_twitterAccessor.ExecuteCursorGETQuery <ITwitterListDTO, ITwitterListCursorQueryResultDTO>(baseQuery, maximumNumberOfListsToRetrieve)); }