Beispiel #1
0
        public ITentRequestDate FromPost(ITentRequestPost post, TentFeedRequestSort sortBy)
        {
            Ensure.Argument.IsNotNull(post, nameof(post));
            Ensure.Argument.IsNotNull(post.Post, nameof(post.Post));

            // Create the resulting Request Date object.
            var result = new TentRequestDate(this.uriHelpers)
            {
                Version = post.Post.Version.Id
            };

            // Pick the correct date on the specified post.
            switch (sortBy)
            {
                case TentFeedRequestSort.VersionPublishedAt:
                    result.Date = post.Post.Version.PublishedAt.GetValueOrDefault();
                    break;
                case TentFeedRequestSort.VersionReceivedAt:
                    result.Date = post.Post.Version.ReceivedAt.GetValueOrDefault();
                    break;
                case TentFeedRequestSort.PublishedAt:
                    result.Date = post.Post.PublishedAt.GetValueOrDefault();
                    break;
                default:
                    result.Date = post.Post.ReceivedAt.GetValueOrDefault();
                    break;
            }

            return result;
        }
Beispiel #2
0
 public ITentFeedRequest AddPostBoundary(ITentRequestPost boundaryPost, TentFeedRequestBoundaryType boundaryType)
 {
     Ensure.Argument.IsNotNull(boundaryPost, nameof(boundaryPost));
     (this.temporaryBoundaryPosts ?? (this.temporaryBoundaryPosts = new Dictionary<TentFeedRequestBoundaryType, ITentRequestPost>()))[boundaryType] = boundaryPost;
     return this;
 }