Пример #1
0
        public string GetMuteQuery(string screenName)
        {
            if (!_userQueryValidator.IsScreenNameValid(screenName))
            {
                return(null);
            }

            string userScreenNameParameter = _userQueryParameterGenerator.GenerateScreenNameParameter(screenName);

            return(GenerateCreateMuteQuery(userScreenNameParameter));
        }
Пример #2
0
        public string GetFriendIdsQuery(string screenName, int maxFriendsToRetrieve)
        {
            if (!_userQueryValidator.IsScreenNameValid(screenName))
            {
                return(null);
            }

            string userScreenNameParameter = _userQueryParameterGenerator.GenerateScreenNameParameter(screenName);

            return(GenerateGetFriendIdsQuery(userScreenNameParameter, maxFriendsToRetrieve));
        }
Пример #3
0
        public string GenerateScreenNameParameter(string screenName, string parameterName = "screen_name")
        {
            if (!_userQueryValidator.IsScreenNameValid(screenName))
            {
                return(null);
            }

            return(String.Format("{0}={1}", parameterName, screenName));
        }
Пример #4
0
        public string GetUserSubscribedListsQuery(string userScreenName, bool getOwnedListsFirst)
        {
            if (!_userQueryValidator.IsScreenNameValid(userScreenName))
            {
                return(null);
            }

            var userIdentifier = _userQueryParameterGenerator.GenerateScreenNameParameter(userScreenName);

            return(GenerateUserListsQuery(userIdentifier, getOwnedListsFirst));
        }
Пример #5
0
        public string GetUserTimelineQuery(string screenName, int maximumTweets, bool excludeReplies)
        {
            if (!_userQueryValidator.IsScreenNameValid(screenName))
            {
                return(null);
            }

            string userScreenNameParameter = _userQueryParameterGenerator.GenerateScreenNameParameter(screenName);

            return(GetUserTimelineBaseQuery(userScreenNameParameter, maximumTweets, excludeReplies));
        }
        public string GetPublishMessageQuery(string messageText, string targetUserScreenName)
        {
            if (!_messageQueryValidator.IsMessageTextValid(messageText) || !_userQueryValidator.IsScreenNameValid(targetUserScreenName))
            {
                return(null);
            }

            string userScreenNameParameter = _userQueryParameterGenerator.GenerateScreenNameParameter(targetUserScreenName);

            return(GetPublishMessageFormattedQuery(messageText, userScreenNameParameter));
        }
        public bool CanMessageDTOBePublished(IMessageDTO messageDTO)
        {
            bool isMessageInValidState = messageDTO != null &&
                                         !messageDTO.IsMessagePublished &&
                                         !messageDTO.IsMessageDestroyed;

            if (!isMessageInValidState)
            {
                return(false);
            }

            bool isRecipientValid = _userQueryValidator.CanUserBeIdentified(messageDTO.Recipient) ||
                                    _userQueryValidator.IsUserIdValid(messageDTO.RecipientId) ||
                                    _userQueryValidator.IsScreenNameValid(messageDTO.RecipientScreenName);

            bool messageTextIsValid = IsMessageTextValid(messageDTO.Text);

            return(isRecipientValid && messageTextIsValid);
        }
Пример #8
0
        public bool CanMessageBePublished(IMessagePublishParameters parameters)
        {
            var message = parameters.Message;
            var text    = parameters.Text;

            bool messageTextIsValid = IsMessageTextValid(text);
            bool isRecipientValid   = _userQueryValidator.CanUserBeIdentified(parameters.Recipient) ||
                                      _userQueryValidator.IsUserIdValid(parameters.RecipientId) ||
                                      _userQueryValidator.IsScreenNameValid(parameters.RecipientScreenName);

            bool isMessageInValidState = message == null || (!message.IsMessagePublished && !message.IsMessageDestroyed);

            if (!isMessageInValidState)
            {
                return(false);
            }

            return(isRecipientValid && messageTextIsValid);
        }