public void Validate(IGetUserIdsRequestingFriendshipParameters parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
 }
Exemplo n.º 2
0
        public string GetUserIdsRequestingFriendshipQuery(IGetUserIdsRequestingFriendshipParameters parameters)
        {
            var query = new StringBuilder(Resources.Friendship_GetIncomingIds);

            _queryParameterGenerator.AppendCursorParameters(query, parameters);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public GetUserIdsRequestingFriendshipParameters(IGetUserIdsRequestingFriendshipParameters parameters) : base(parameters)
        {
            if (parameters == null)
            {
                PageSize = TwitterLimits.DEFAULTS.ACCOUNT_GET_USER_IDS_REQUESTING_FRIENDSHIP_MAX_PAGE_SIZE;
                return;
            }

            PageSize = parameters.PageSize;
        }
        public void Validate(IGetUserIdsRequestingFriendshipParameters parameters)
        {
            _usersClientRequiredParametersValidator.Validate(parameters);

            var maxPageSize = Limits.ACCOUNT_GET_USER_IDS_REQUESTING_FRIENDSHIP_MAX_PAGE_SIZE;

            if (parameters.PageSize > maxPageSize)
            {
                throw new TwitterArgumentLimitException($"{nameof(parameters)}.{nameof(parameters.PageSize)}", maxPageSize, nameof(Limits.ACCOUNT_GET_USER_IDS_REQUESTING_FRIENDSHIP_MAX_PAGE_SIZE),
                                                        "page size");
            }
        }
Exemplo n.º 5
0
 public void Validate(IGetUserIdsRequestingFriendshipParameters parameters)
 {
     _usersClientParametersValidator.Validate(parameters);
 }
Exemplo n.º 6
0
        public Task <ITwitterResult <IIdsCursorQueryResultDTO> > GetUserIdsRequestingFriendship(IGetUserIdsRequestingFriendshipParameters parameters, ITwitterRequest request)
        {
            var query = _userQueryGenerator.GetUserIdsRequestingFriendshipQuery(parameters);

            request.Query.Url        = query;
            request.Query.HttpMethod = HttpMethod.GET;
            return(_twitterAccessor.ExecuteRequest <IIdsCursorQueryResultDTO>(request));
        }
Exemplo n.º 7
0
        public ITwitterIterator <long> GetUserIdsRequestingFriendshipIterator(IGetUserIdsRequestingFriendshipParameters parameters)
        {
            var iterator = _usersRequester.GetUserIdsRequestingFriendshipIterator(parameters);

            return(new TwitterIteratorProxy <ITwitterResult <IIdsCursorQueryResultDTO>, long>(iterator, dto => dto.DataTransferObject.Ids));
        }
Exemplo n.º 8
0
        public async Task <long[]> GetUserIdsRequestingFriendship(IGetUserIdsRequestingFriendshipParameters parameters)
        {
            var iterator = GetUserIdsRequestingFriendshipIterator(parameters);

            return((await iterator.NextPage().ConfigureAwait(false)).ToArray());
        }
Exemplo n.º 9
0
        public ITwitterPageIterator <ITwitterResult <IIdsCursorQueryResultDTO> > GetUserIdsRequestingFriendshipIterator(IGetUserIdsRequestingFriendshipParameters parameters)
        {
            _validator.Validate(parameters);

            var request = TwitterClient.CreateRequest();

            request.ExecutionContext.Converters = JsonQueryConverterRepository.Converters;
            return(_userController.GetUserIdsRequestingFriendshipIterator(parameters, request));
        }
Exemplo n.º 10
0
        public ITwitterPageIterator <ITwitterResult <IIdsCursorQueryResultDTO> > GetUserIdsRequestingFriendshipIterator(IGetUserIdsRequestingFriendshipParameters parameters, ITwitterRequest request)
        {
            var twitterCursorResult = new TwitterPageIterator <ITwitterResult <IIdsCursorQueryResultDTO> >(
                parameters.Cursor,
                cursor =>
            {
                var cursoredParameters = new GetUserIdsRequestingFriendshipParameters(parameters)
                {
                    Cursor = cursor
                };

                return(_userQueryExecutor.GetUserIdsRequestingFriendship(cursoredParameters, new TwitterRequest(request)));
            },
                page => page.DataTransferObject.NextCursorStr,
                page => page.DataTransferObject.NextCursorStr == "0");

            return(twitterCursorResult);
        }