Пример #1
0
        public string GetMuteQuery(IUserIdentifier user)
        {
            _userQueryValidator.ThrowIfUserCannotBeIdentified(user);

            string userIdParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(user);

            return(GenerateCreateMuteQuery(userIdParameter));
        }
Пример #2
0
        // Get Existing Relationship
        public IRelationshipDTO GetRelationshipBetween(IUserIdentifier sourceUserDTO, IUserIdentifier 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));
        }
        // Get Existing Relationship
        public string GetRelationshipDetailsQuery(IUserIdentifier sourceUserIdentifier, IUserIdentifier targetUserIdentifier)
        {
            _userQueryValidator.ThrowIfUserCannotBeIdentified(sourceUserIdentifier, "Source user");
            _userQueryValidator.ThrowIfUserCannotBeIdentified(targetUserIdentifier, "Target user");

            var sourceParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(sourceUserIdentifier, "source_id", "source_screen_name");
            var targetParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(targetUserIdentifier, "target_id", "target_screen_name");

            return(string.Format(Resources.Friendship_GetRelationship, sourceParameter, targetParameter));
        }
Пример #4
0
        public string GetMuteQuery(IUserIdentifier userIdentifier)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userIdentifier))
            {
                return(null);
            }

            string userIdParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userIdentifier);

            return(GenerateCreateMuteQuery(userIdParameter));
        }
Пример #5
0
        public string GetListsSubscribedByUserQuery(IGetListsSubscribedByUserParameters parameters)
        {
            var query = new StringBuilder(Resources.List_GetUserLists);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddParameterToQuery("reverse", parameters.Reverse);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Пример #6
0
        // Friends
        public string GetFriendIdsQuery(IUserIdDTO userDTO, int maxFriendsToRetrieve)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            string userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GenerateGetFriendIdsQuery(userIdentifierParameter, maxFriendsToRetrieve));
        }
        // Create Friendship
        public string GetCreateFriendshipWithQuery(IUserIdentifier userDTO)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userDTO))
            {
                return(null);
            }

            var userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userDTO);

            return(GenerateCreateFriendshipQuery(userIdentifierParameter));
        }
        // Get Existing Relationship
        public string GetRelationshipDetailsQuery(IUserIdentifier sourceUserIdentifier, IUserIdentifier targetUserIdentifier)
        {
            if (!_userQueryValidator.CanUserBeIdentified(sourceUserIdentifier) ||
                !_userQueryValidator.CanUserBeIdentified(targetUserIdentifier))
            {
                return(null);
            }

            string sourceParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(sourceUserIdentifier, "source_id", "source_screen_name");
            string targetParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(targetUserIdentifier, "target_id", "target_screen_name");

            return(string.Format(Resources.Friendship_GetRelationship, sourceParameter, targetParameter));
        }
        // User Lists
        public string GetUserSubscribedListsQuery(IUserIdentifier user, bool getOwnedListsFirst)
        {
            _userQueryValidator.ThrowIfUserCannotBeIdentified(user);

            var identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(user);

            return(string.Format(Resources.List_GetUserLists, identifierParameter, getOwnedListsFirst));
        }
Пример #10
0
        private string GenerateUserTimelineRequestParameters(IUserTimelineRequestParameters userTimelineRequestParameters)
        {
            var requestParameter = new StringBuilder();

            requestParameter.Append(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userTimelineRequestParameters.UserIdentifier));
            requestParameter.Append(_timelineQueryParameterGenerator.GenerateIncludeRTSParameter(userTimelineRequestParameters.IncludeRTS));
            requestParameter.Append(_timelineQueryParameterGenerator.GenerateExcludeRepliesParameter(userTimelineRequestParameters.ExcludeReplies));

            return(requestParameter.ToString());
        }
Пример #11
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));
        }
Пример #12
0
        public string GetUserListsQuery(IUserIdentifier userIdentifier, bool getOwnedListsFirst)
        {
            if (!_userQueryValidator.CanUserBeIdentified(userIdentifier))
            {
                return(null);
            }

            var userIdParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userIdentifier);

            return(GenerateUserListsQuery(userIdParameter, getOwnedListsFirst));
        }
        public string GetPublishMessageQuery(string messageText, IUserIdentifier targetUserDTO)
        {
            if (!_messageQueryValidator.IsMessageTextValid(messageText) || !_userQueryValidator.CanUserBeIdentified(targetUserDTO))
            {
                return(null);
            }

            string identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(targetUserDTO);

            return(GetPublishMessageFormattedQuery(messageText, identifierParameter));
        }
Пример #14
0
        public string GetFavoriteTweetsQuery(IGetUserFavoriteTweetsParameters parameters, ComputedTweetMode tweetMode)
        {
            var userParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User);
            var query         = new StringBuilder(Resources.User_GetFavorites + userParameter);

            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            _queryParameterGenerator.AddMinMaxQueryParameters(query, parameters);

            query.AddParameterToQuery("tweet_mode", tweetMode);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Пример #15
0
        // Friends
        public string GetFriendIdsQuery(IUserIdentifier userIdentifier, int maxFriendsToRetrieve)
        {
            _userQueryValidator.ThrowIfUserCannotBeIdentified(userIdentifier);

            string userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userIdentifier);

            return(GenerateGetFriendIdsQuery(userIdentifierParameter, maxFriendsToRetrieve));
        }
Пример #16
0
        // User Timeline
        public string GetUserTimelineQuery(IGetUserTimelineParameters parameters, TweetMode?requestTweetMode)
        {
            var query = new StringBuilder(Resources.Timeline_GetUserTimeline);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));

            _queryParameterGenerator.AddTimelineParameters(query, parameters, requestTweetMode);

            query.AddParameterToQuery("exclude_replies", parameters.ExcludeReplies);
            query.AddParameterToQuery("include_rts", parameters.IncludeRetweets);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Пример #17
0
        // Publish Message
        public string GetPublishMessageQuery(IMessagePublishParameters parameters)
        {
            var messageText = parameters.Text;
            var recipient   = parameters.Recipient;

            if (!_messageQueryValidator.IsMessageTextValid(messageText) || !_userQueryValidator.CanUserBeIdentified(recipient))
            {
                return(null);
            }

            string identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(recipient);

            return(GetPublishMessageFormattedQuery(messageText, identifierParameter));
        }
Пример #18
0
        // Publish Message
        public string GetPublishMessageQuery(IPublishMessageParameters parameters)
        {
            _messageQueryValidator.ThrowIfMessageCannotBePublished(parameters);

            var messageText = parameters.Text;
            var recipient   = parameters.Recipient;

            var identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(recipient);

            var query = string.Format(Resources.Message_NewMessage, _twitterStringFormatter.TwitterEncode(messageText), identifierParameter);

            query += _queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters);

            return(query);
        }
Пример #19
0
        // Publish Message
        public string GetPublishMessageQuery(IPublishMessageParameters parameters)
        {
            var messageText = parameters.Text;
            var recipient   = parameters.Recipient;

            if (!_messageQueryValidator.IsMessageTextValid(messageText) || !_userQueryValidator.CanUserBeIdentified(recipient))
            {
                return(null);
            }

            var identifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(recipient);

            var query = GetPublishMessageFormattedQuery(messageText, identifierParameter);

            query += _queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters);

            return(query);
        }
        public void AppendListIdentifierParameter(StringBuilder query, ITwitterListIdentifier listIdentifier)
        {
            var owner = new UserIdentifier(listIdentifier.OwnerScreenName);

            if (listIdentifier.OwnerId > 0)
            {
                owner.Id = listIdentifier.OwnerId;
            }

            if (listIdentifier.Id > 0)
            {
                query.AddParameterToQuery("list_id", listIdentifier.Id);
            }
            else
            {
                query.AddParameterToQuery("slug", listIdentifier.Slug);

                var ownerParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(owner, "owner_id", "owner_screen_name");
                query.AddFormattedParameterToQuery(ownerParameter);
            }
        }
Пример #21
0
        public string GetUserQuery(IGetUserParameters parameters)
        {
            var query = new StringBuilder(Resources.User_GetUser);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddParameterToQuery("skip_status", parameters.SkipStatus);
            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }