Example #1
0
        public string UpdateRelationshipAuthorizationsWith(IUserIdDTO userDTO, bool retweetsEnabled, bool deviceNotifictionEnabled)
        {
            var    friendshipAuthorizations = _friendshipFactory.GenerateFriendshipAuthorizations(retweetsEnabled, deviceNotifictionEnabled);
            string query = _friendshipQueryGenerator.GetUpdateRelationshipAuthorizationsWithQuery(userDTO, friendshipAuthorizations);

            return(_twitterAccessor.ExecuteJsonPOSTQuery(query));
        }
        // Get Existing Relationship
        public IRelationshipDTO GetRelationshipBetween(IUserIdDTO sourceUserDTO, IUserIdDTO targetUserDTO)
        {
            string sourceParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(sourceUserDTO, "source_id", "source_screen_name");
            string targetParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(targetUserDTO, "target_id", "target_screen_name");
            string query           = String.Format(Resources.Friendship_GetRelationship, sourceParameter, targetParameter);

            return(_twitterAccessor.ExecuteGETQuery <IRelationshipDTO>(query));
        }
        // Destroy Friendship
        public bool DestroyFriendshipWith(IUserIdDTO userDTO)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(false);
            }

            string query = _friendshipQueryGenerator.GetDestroyFriendshipWithQuery(userDTO);

            return(_twitterAccessor.TryExecutePOSTQuery(query));
        }
        // Followers
        public string GetFollowerIdsQuery(IUserIdDTO userDTO, int maxFollowersToRetrieve)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            string userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GenerateGetFollowerIdsQuery(userIdentifierParameter, maxFollowersToRetrieve));
        }
        // Block User
        public string GetBlockUserQuery(IUserIdDTO userDTO)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            string userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(String.Format(Resources.User_Block_Create, userIdentifierParameter));
        }
Example #6
0
        public string GetPublishMessageQuery(string messageText, IUserIdDTO targetUserDTO)
        {
            if (!_messageQueryValidator.IsMessageTextValid(messageText) || !_userQueryValidator.CanUserBeIdentified(targetUserDTO))
            {
                return(null);
            }

            string identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(targetUserDTO);

            return(String.Format(Resources.Message_NewMessage, messageText, identifierParameter));
        }
        public string GetUserListsQuery(IUserIdDTO userIdDTO, bool getOwnedListsFirst)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userIdDTO))
            {
                return(null);
            }

            var userIdentifier = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userIdDTO);

            return(GenerateUserListsQuery(userIdentifier, getOwnedListsFirst));
        }
        // Destroy Friendship
        public string GetDestroyFriendshipWithQuery(IUserIdDTO userDTO)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            var userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GenerateDestroyFriendshipQuery(userIdentifierParameter));
        }
        // Update Friendship Authorizations
        public bool UpdateRelationshipAuthorizationsWith(IUserIdDTO userDTO, IFriendshipAuthorizations friendshipAuthorizations)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(false);
            }

            string query = _friendshipQueryGenerator.GetUpdateRelationshipAuthorizationsWithQuery(userDTO, friendshipAuthorizations);

            return(_twitterAccessor.TryExecutePOSTQuery(query));
        }
Example #10
0
        public string GetUserTimelineQuery(IUserIdDTO userDTO, int maximumTweets, bool excludeReplies)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            var userParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GetUserTimelineBaseQuery(userParameter, maximumTweets, excludeReplies));
        }
        // Update Relationship
        public string GetUpdateRelationshipAuthorizationsWithQuery(IUserIdDTO userDTO, IFriendshipAuthorizations friendshipAuthorizations)
        {
            if (friendshipAuthorizations == null || !_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            var userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GetUpdateRelationshipAuthorizationQuery(userIdentifierParameter, friendshipAuthorizations));
        }
Example #12
0
        public IListIdentifier Create(string slug, IUserIdDTO userDTO)
        {
            if (userDTO == null)
            {
                return(null);
            }

            if (userDTO.Id != TweetinviConstants.DEFAULT_ID)
            {
                return(Create(slug, userDTO.Id));
            }

            if (!String.IsNullOrEmpty(userDTO.ScreenName))
            {
                return(Create(slug, userDTO.ScreenName));
            }

            return(null);
        }
        public string GenerateIdOrScreenNameParameter(
            IUserIdDTO userDTO,
            string idParameterName         = "user_id",
            string screenNameParameterName = "screen_name")
        {
            if (userDTO == null)
            {
                throw new ArgumentException("Cannot extract id or name parameter from a null userDTO.");
            }

            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                throw new ArgumentException("Cannot extract either id or name parameter from the given userDTO.");
            }

            if (_userQueryValidator.IsUserIdValid(userDTO.Id))
            {
                return(GenerateUserIdParameter(userDTO.Id, idParameterName));
            }

            return(GenerateScreenNameParameter(userDTO.ScreenName, screenNameParameterName));
        }
Example #14
0
 public static bool BlockUser(IUserIdDTO userDTO)
 {
     return(_userController.BlockUser(userDTO));
 }
        // Followers
        public IEnumerable <long> GetFollowerIds(IUserIdDTO userDTO, int maxFollowersToRetrieve)
        {
            string query = _userQueryGenerator.GetFollowerIdsQuery(userDTO, maxFollowersToRetrieve);

            return(ExecuteGetUserIdsQuery(query, maxFollowersToRetrieve));
        }
        // Block
        public bool BlockUser(IUserIdDTO userDTO)
        {
            string query = _userQueryGenerator.GetBlockUserQuery(userDTO);

            return(_twitterAccessor.TryExecutePOSTQuery(query));
        }
        // Favourites
        public IEnumerable <ITweetDTO> GetFavouriteTweets(IUserIdDTO userDTO, int maxFavouritesToRetrieve)
        {
            string query = _userQueryGenerator.GetFavouriteTweetsQuery(userDTO, maxFavouritesToRetrieve);

            return(_twitterAccessor.ExecuteGETQuery <IEnumerable <ITweetDTO> >(query));
        }
Example #18
0
 public static IEnumerable <IUser> GetMembersOfList(string slug, IUserIdDTO ownerDTO, int maxNumberOfUsersToRetrieve = 100)
 {
     return(_tweetlistController.GetMembersOfList(slug, ownerDTO, maxNumberOfUsersToRetrieve));
 }
Example #19
0
 public static ITweetList UpdateList(string slug, IUserIdDTO ownerDTO, IListUpdateParameters parameters)
 {
     return(TweetListController.UpdateList(slug, ownerDTO, parameters));
 }
Example #20
0
 public static string GetUserTimeline(IUserIdDTO userDTO, int maximumTweets = 40, bool excludeReplies = false)
 {
     return(TimelineJsonController.GetUserTimeline(userDTO, maximumTweets, excludeReplies));
 }
Example #21
0
        public ITweetList GetExistingTweetList(string slug, IUserIdDTO userDTO)
        {
            var identifier = _listIdentifierFactory.Create(slug, userDTO);

            return(GetExistingTweetList(identifier));
        }
Example #22
0
 public static IEnumerable <long> GetFriendIds(IUserIdDTO userDTO, int maxFriendsToRetrieve = 5000)
 {
     return(UserController.GetFriendIds(userDTO, maxFriendsToRetrieve));
 }
Example #23
0
        public string CreateFriendshipWith(IUserIdDTO userDTO)
        {
            string query = _friendshipQueryGenerator.GetCreateFriendshipWithQuery(userDTO);

            return(_twitterAccessor.ExecuteJsonPOSTQuery(query));
        }
        public IRelationship GetRelationshipBetween(IUserIdDTO sourceUserDTO, IUserIdDTO targetUserDTO)
        {
            var relationshipDTO = _friendshipFactoryQueryExecutor.GetRelationshipBetween(sourceUserDTO, targetUserDTO);

            return(GenerateRelationshipFromRelationshipDTO(relationshipDTO));
        }
Example #25
0
 public static IEnumerable <ITweetList> GetUserLists(IUserIdDTO userDTO, bool getOwnedListsFirst)
 {
     return(TweetListController.GetUserLists(userDTO, getOwnedListsFirst));
 }
        public string GetFavouriteTweets(IUserIdDTO userDTO, int maxFavouritesToRetrieve = 40)
        {
            string query = _userQueryGenerator.GetFavouriteTweetsQuery(userDTO, maxFavouritesToRetrieve);

            return(_twitterAccessor.ExecuteJsonGETQuery(query));
        }
Example #27
0
 public static IEnumerable <ITweet> GetTweetsFromList(string slug, IUserIdDTO ownerDTO)
 {
     return(_tweetlistController.GetTweetsFromList(slug, ownerDTO));
 }
        public IEnumerable <string> GetFollowerIds(IUserIdDTO userDTO, int maxFollowersToRetrieve = 5000)
        {
            string query = _userQueryGenerator.GetFollowerIdsQuery(userDTO, maxFollowersToRetrieve);

            return(_twitterAccessor.ExecuteJsonCursorGETQuery <IIdsCursorQueryResultDTO>(query));
        }
Example #29
0
 public static ITweetList GetExistingList(string slug, IUserIdDTO userDTO)
 {
     return(TweetListFactory.GetExistingTweetList(slug, userDTO));
 }
        public IEnumerable <ITweet> GetUserTimeline(IUserIdDTO userDTO, int maximumTweets = 40, bool excludeReplies = false)
        {
            var tweetsDTO = _timelineQueryExecutor.GetUserTimeline(userDTO, maximumTweets, excludeReplies);

            return(_tweetFactory.GenerateTweetsFromDTO(tweetsDTO));
        }