// Get Relationship with public IEnumerable <IRelationshipStateDTO> GetMultipleRelationshipsQuery(IEnumerable <IUserIdentifier> targetUserIdentifiers) { var targetUserIdentifiersArray = IEnumerableExtension.GetDistinctUserIdentifiers(targetUserIdentifiers); var distinctRelationships = new List <IRelationshipStateDTO>(); for (int i = 0; i < targetUserIdentifiersArray.Length; i += TweetinviConsts.FRIENDSHIP_MAX_NUMBER_OF_FRIENDSHIP_TO_GET_IN_A_SINGLE_QUERY) { var userIdentifiersToAnalyze = targetUserIdentifiersArray.Skip(i).Take(TweetinviConsts.FRIENDSHIP_MAX_NUMBER_OF_FRIENDSHIP_TO_GET_IN_A_SINGLE_QUERY).ToArray(); var query = _friendshipQueryGenerator.GetMultipleRelationshipsQuery(userIdentifiersToAnalyze); var relationshipStateDtos = _twitterAccessor.ExecuteGETQuery <IEnumerable <IRelationshipStateDTO> >(query); distinctRelationships.AddRange(relationshipStateDtos); } return(distinctRelationships); }
public MultiRequestsResult RemoveMultipleMembersFromList(ITwitterListIdentifier listIdentifier, IEnumerable <IUserIdentifier> users) { var usersArray = IEnumerableExtension.GetDistinctUserIdentifiers(users); for (int i = 0; i < usersArray.Length; i += TweetinviConsts.LIST_ADD_OR_REMOVE_MULTIPLE_MEMBERS_MAX) { var usersToAdd = usersArray.Skip(i).Take(TweetinviConsts.LIST_ADD_OR_REMOVE_MULTIPLE_MEMBERS_MAX).ToArray(); var query = _listsQueryGenerator.GetRemoveMultipleMembersFromListQuery(listIdentifier, usersToAdd); if (!_twitterAccessor.TryExecutePOSTQuery(query)) { return(i > 0 ? MultiRequestsResult.Partial : MultiRequestsResult.Failure); } } return(MultiRequestsResult.Success); }