Example #1
0
        private ITweetList GetExistingTweetList(IListIdentifier identifier)
        {
            if (identifier == null)
            {
                return(null);
            }

            var tweetListDTO = _tweetListFactoryQueryExecutor.GetExistingTweetList(identifier);

            return(GenerateTweetListFromDTO(tweetListDTO));
        }
Example #2
0
        public string GetListByIdQuery(IListIdentifier listIdentifier)
        {
            if (!_listsQueryValidator.IsListIdentifierValid(listIdentifier))
            {
                return(null);
            }

            var identifierParameter = _listQueryParameterGenerator.GenerateIdentifierParameter(listIdentifier);

            return(String.Format(Resources.List_GetExistingList, identifierParameter));
        }
Example #3
0
        public string GetMembersFromListQuery(IListIdentifier identifier)
        {
            if (!_listsQueryValidator.IsListIdentifierValid(identifier))
            {
                return(null);
            }

            var identifierParameter = _tweetListQueryParameterGenerator.GenerateIdentifierParameter(identifier);

            return(String.Format(Resources.List_Members, identifierParameter));
        }
        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));
        }
Example #5
0
        public string GetUpdateListQuery(IListIdentifier identifier, IListUpdateParameters parameters)
        {
            if (!_listsQueryValidator.IsListIdentifierValid(identifier) ||
                !_listsQueryValidator.IsListUpdateParametersValid(parameters))
            {
                return(null);
            }

            var listIdentifierParameter = _tweetListQueryParameterGenerator.GenerateIdentifierParameter(identifier);
            var updateQueryParameters   = GenerateUpdateAdditionalParameters(parameters);

            var queryParameters = String.Format("{0}{1}", listIdentifierParameter, updateQueryParameters);

            return(String.Format(Resources.List_Update, queryParameters));
        }
        public bool IsListIdentifierValid(IListIdentifier listIdentifier)
        {
            if (listIdentifier == null)
            {
                return(false);
            }

            if (listIdentifier.ListId != TweetinviConfig.DEFAULT_ID)
            {
                return(true);
            }

            bool isOwnerIdentifierValid = IsOwnerIdValid(listIdentifier.OwnerId) || IsOwnerScreenNameValid(listIdentifier.OwnerScreenName);

            return(IsSlugValid(listIdentifier.Slug) && isOwnerIdentifierValid);
        }
        public string GenerateIdentifierParameter(IListIdentifier listIdentifier)
        {
            if (listIdentifier.ListId != TweetinviConstants.DEFAULT_ID)
            {
                return(String.Format(Resources.List_ListIdParameter, listIdentifier.ListId));
            }

            string ownerIdentifier;

            if (_userQueryValidator.IsUserIdValid(listIdentifier.OwnerId))
            {
                ownerIdentifier = String.Format(Resources.List_OwnerIdParameter, listIdentifier.OwnerId.ToString(CultureInfo.InvariantCulture));
            }
            else
            {
                ownerIdentifier = String.Format(Resources.List_OwnerScreenNameParameter, listIdentifier.OwnerScreenName);
            }

            var slugParameter = String.Format(Resources.List_SlugParameter, listIdentifier.Slug);

            return(String.Format("{0}&{1}", slugParameter, ownerIdentifier));
        }
Example #8
0
        // Get existing list
        public ITweetListDTO GetExistingTweetList(IListIdentifier identifier)
        {
            string query = _tweetListFactoryQueryGenerator.GetListByIdQuery(identifier);

            return(_twitterAccessor.ExecuteGETQuery <ITweetListDTO>(query));
        }
        // Get Tweets from list
        public IEnumerable <ITweetDTO> GetTweetsFromList(IListIdentifier identifier)
        {
            string query = _listsQueryGenerator.GetTweetsFromListQuery(identifier);

            return(_twitterAccessor.ExecuteGETQuery <IEnumerable <ITweetDTO> >(query));
        }
        // Destroy List
        public bool DestroyList(IListIdentifier identifier)
        {
            string query = _listsQueryGenerator.GetDestroyListQuery(identifier);

            return(_twitterAccessor.TryExecutePOSTQuery(query));
        }
        // Update List
        public ITweetListDTO UpdateList(IListIdentifier identifier, IListUpdateParameters parameters)
        {
            string query = _listsQueryGenerator.GetUpdateListQuery(identifier, parameters);

            return(_twitterAccessor.ExecutePOSTQuery <ITweetListDTO>(query));
        }
        public IEnumerable <IUser> GetMembersOfList(IListIdentifier identifier, int maxNumberOfUsersToRetrieve = 100)
        {
            var usersDTO = _listsQueryExecutor.GetMembersOfList(identifier, maxNumberOfUsersToRetrieve);

            return(_userFactory.GenerateUsersFromDTO(usersDTO));
        }
        public IEnumerable <ITweet> GetTweetsFromList(IListIdentifier identifier)
        {
            var tweetsDTO = _listsQueryExecutor.GetTweetsFromList(identifier);

            return(_tweetFactory.GenerateTweetsFromDTO(tweetsDTO));
        }
 public bool DestroyList(IListIdentifier identifier)
 {
     return(_listsQueryExecutor.DestroyList(identifier));
 }
        public ITweetList UpdateList(IListIdentifier identifier, IListUpdateParameters parameters)
        {
            var tweetListDTO = _listsQueryExecutor.UpdateList(identifier, parameters);

            return(_listsFactory.GenerateTweetListFromDTO(tweetListDTO));
        }