Exemple #1
0
        public ITwitterPageIterator <ITwitterResult <T[]>, long?> Create <T>(IMinMaxQueryParameters parameters, Func <long?, Task <ITwitterResult <T[]> > > getNext) where T : ITwitterIdentifier
        {
            var twitterCursorResult = new TwitterPageIterator <ITwitterResult <T[]>, long?>(
                parameters.MaxId,
                getNext,
                page =>
            {
                if (page.DataTransferObject.Length == 0)
                {
                    return(null);
                }

                return(page.DataTransferObject?.Min(x => x.Id) - 1);
            },
                page =>
            {
                if (parameters.ContinueMinMaxCursor == ContinueMinMaxCursor.UntilPageSizeIsDifferentFromRequested)
                {
                    return(page.DataTransferObject.Length < parameters.PageSize);
                }

                return(page.DataTransferObject.Length == 0);
            });

            return(twitterCursorResult);
        }
Exemple #2
0
        public ITwitterPageIterator <ITwitterResult <T> > Create <T>(ICursorQueryParameters parameters, Func <string, Task <ITwitterResult <T> > > getNext) where T : IBaseCursorQueryDTO
        {
            var twitterCursorResult = new TwitterPageIterator <ITwitterResult <T> >(
                parameters.Cursor,
                getNext,
                page => page.DataTransferObject.NextCursorStr,
                page => page.DataTransferObject.NextCursorStr == "0");

            return(twitterCursorResult);
        }