예제 #1
0
        private async Task <GetNewsfeedQuery> GetNewsfeedQuery(NewsfeedFilter filterData)
        {
            filterData.AssertUrlParameterProvided("filter");
            var filter = filterData.Parse();

            UserId creatorId = null;

            if (!string.IsNullOrWhiteSpace(filterData.CreatorId))
            {
                creatorId = new UserId(filterData.CreatorId.DecodeGuid());
            }

            IReadOnlyList <ChannelId> channelIds = null;

            if (!string.IsNullOrWhiteSpace(filterData.ChannelId))
            {
                channelIds = new List <ChannelId> {
                    new ChannelId(filterData.ChannelId.DecodeGuid())
                };
            }

            var requester = await this.requesterContext.GetRequesterAsync();

            var query = new GetNewsfeedQuery(
                requester,
                creatorId,
                channelIds,
                filter.Origin,
                filter.SearchForwards,
                filter.StartIndex,
                filter.Count);

            return(query);
        }
예제 #2
0
        public async Task <GetPreviewNewsfeedQueryResult> GetPreviewNewsfeed([FromUri] NewsfeedFilter filterData)
        {
            var query = await this.GetNewsfeedQuery(filterData);

            return(await this.getPreviewNewsfeed.HandleAsync(query));
        }