public Item MapTweetToItem()

in Twitter/SDK/TwitterSchemaToItemMapper.cs [40:78]


        public Item MapTweetToItem(Tweet tweet)
        {
            if (tweet == null)
                return null;

            var parentItem = tweet.InReplyToStatusId == null ? null : tweet.IsQuotedStatus ? MapTweetToItem(tweet.QuotedStatus) : MapTweetToItem(tweet.RetweetedStatus);

            Item postItem = new Item()
            {
                SchemaVersion = new Version(1, 0),
                Id = tweet.Tweetid,
                ContainerId = tweet.User.Id.ToString(),
                ContainerName = tweet.User.Name,
                SourceType = "Twitter",
                ItemType = "Tweet",
                ContentType = ContentType.Text,
                Content = tweet.TweetText.ToString(),
                ParentId = tweet.InReplyToStatusId,
                ThreadId = tweet.InReplyToStatusId,
                SentTimeUtc = DateTime.ParseExact(tweet.CreatedAt, Const_TwitterDateTemplate, new System.Globalization.CultureInfo("en-US")),
                Sender = TweetUserToItemUser(tweet.User),
                Recipients = Array.Empty<User>(),
                NumOfLikes = tweet.FavoriteCount,
                MessagePreviewText = tweet.TweetText.ToString(),
                PreContext = parentItem == null ? null : new List<Item>{
                   parentItem
                },
                PostContext = null
            };
            postItem.ContentAttachments = MapAttachments(tweet);

            if (!tweet.InReplyToUserId.Equals(tweet.User.Id))
            {
                postItem.ParentId = string.Empty;
                postItem.ThreadId = string.Empty;
            }

            return postItem;
        }