public InstaCaption Convert() { var caption = new InstaCaption { Pk = SourceObject.Pk, CreatedAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.CreatedAtUnixLike), CreatedAtUtc = DateTimeHelper.UnixTimestampToDateTime(SourceObject.CreatedAtUtcUnixLike), MediaId = SourceObject.MediaId, Text = SourceObject.Text, User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(), UserId = SourceObject.UserId }; return(caption); }
public InstaDirectInboxContainer Convert() { var inbox = new InstaDirectInboxContainer { PendingRequestsCount = SourceObject.PendingRequestsCount, SeqId = SourceObject.SeqId }; if (SourceObject.Subscription != null) { var converter = ConvertersFabric.GetDirectSubscriptionConverter(SourceObject.Subscription); inbox.Subscription = converter.Convert(); } if (SourceObject.Inbox != null) { inbox.Inbox = new InstaDirectInbox { HasOlder = SourceObject.Inbox.HasOlder, UnseenCount = SourceObject.Inbox.UnseenCount, UnseenCountTs = SourceObject.Inbox.UnseenCountTs }; if (SourceObject.Inbox.Threads != null && SourceObject.Inbox.Threads.Count > 0) { inbox.Inbox.Threads = new List <InstaDirectInboxThread>(); foreach (var inboxThread in SourceObject.Inbox.Threads) { var converter = ConvertersFabric.GetDirectThreadConverter(inboxThread); inbox.Inbox.Threads.Add(converter.Convert()); } } } if (SourceObject.PendingUsers == null || SourceObject.PendingUsers.Count <= 0) { return(inbox); } { foreach (var user in SourceObject.PendingUsers) { var converter = ConvertersFabric.GetUserConverter(user); inbox.PendingUsers.Add(converter.Convert()); } } return(inbox); }
public InstaComment Convert() { var comment = new InstaComment { BitFlags = SourceObject.BitFlags, ContentType = (InstaContentType)Enum.Parse(typeof(InstaContentType), SourceObject.ContentType, true), CreatedAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.CreatedAt), CreatedAtUtc = DateTimeHelper.UnixTimestampToDateTime(SourceObject.CreatedAtUtc), LikesCount = SourceObject.LikesCount, Pk = SourceObject.Pk, Status = SourceObject.Status, Text = SourceObject.Text, Type = SourceObject.Type, UserId = SourceObject.UserId, User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert() }; return(comment); }
public InstaUserTag Convert() { if (SourceObject == null) { throw new ArgumentNullException($"Source object"); } var userTag = new InstaUserTag(); if (SourceObject.Position?.Length == 2) { userTag.Position = new InstaPosition(SourceObject.Position[0], SourceObject.Position[1]); } userTag.TimeInVideo = SourceObject.TimeInVideo; if (SourceObject.User != null) { userTag.User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(); } return(userTag); }
public InstaDirectInboxThread Convert() { var thread = new InstaDirectInboxThread(); thread.Canonical = SourceObject.Canonical; thread.HasNewer = SourceObject.HasNewer; thread.HasOlder = SourceObject.HasOlder; thread.IsSpam = SourceObject.IsSpam; thread.Muted = SourceObject.Muted; thread.Named = SourceObject.Named; thread.Pending = SourceObject.Pending; thread.VieweId = SourceObject.VieweId; thread.LastActivity = DateTimeHelper.UnixTimestampMilisecondsToDateTime(SourceObject.LastActivity); thread.ThreadId = SourceObject.ThreadId; thread.OldestCursor = thread.OldestCursor; thread.ThreadType = SourceObject.ThreadType; thread.Title = SourceObject.Title; if (SourceObject.Inviter != null) { var userConverter = ConvertersFabric.GetUserConverter(SourceObject.Inviter); thread.Inviter = userConverter.Convert(); } if (SourceObject.Items != null && SourceObject.Items.Count > 0) { thread.Items = new List <InstaDirectInboxItem>(); foreach (var item in SourceObject.Items) { var converter = ConvertersFabric.GetDirectThreadItemConverter(item); thread.Items.Add(converter.Convert()); } } if (SourceObject.Users != null && SourceObject.Users.Count > 0) { thread.Users = new InstaUserList(); foreach (var user in SourceObject.Users) { var converter = ConvertersFabric.GetUserConverter(user); thread.Users.Add(converter.Convert()); } } return(thread); }
public InstaRecentActivityFeed Convert() { var activityStory = new InstaRecentActivityFeed { Pk = SourceObject.Pk, Type = SourceObject.Type, ProfileId = SourceObject.Args.ProfileId, ProfileImage = SourceObject.Args.ProfileImage, Text = SourceObject.Args.Text, TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp) }; if (SourceObject.Args.Links != null) { foreach (var instaLinkResponse in SourceObject.Args.Links) { activityStory.Links.Add(new InstaLink { Start = instaLinkResponse.Start, End = instaLinkResponse.End, Id = instaLinkResponse.Id, Type = instaLinkResponse.Type }); } } if (SourceObject.Args.InlineFollow != null) { activityStory.InlineFollow = new InstaInlineFollow { IsFollowing = SourceObject.Args.InlineFollow.IsFollowing, IsOutgoingRequest = SourceObject.Args.InlineFollow.IsOutgoingRequest }; if (SourceObject.Args.InlineFollow.UserInfo != null) { activityStory.InlineFollow.User = ConvertersFabric.GetUserConverter(SourceObject.Args.InlineFollow.UserInfo).Convert(); } } return(activityStory); }
public InstaStory Convert() { if (SourceObject == null) { throw new ArgumentNullException($"Source object"); } var story = new InstaStory { CanReply = SourceObject.CanReply, ExpiringAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.ExpiringAt), Id = SourceObject.Id, LatestReelMedia = SourceObject.LatestReelMedia, RankedPosition = SourceObject.RankedPosition, Seen = SourceObject.Seen, SeenRankedPosition = SourceObject.SeenRankedPosition, SourceToken = SourceObject.SourceToken }; if (SourceObject.User != null) { story.User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(); } return(story); }
public InstaStory Convert() { if (SourceObject == null) { throw new ArgumentNullException($"Source object"); } var story = new InstaStory { CanReply = SourceObject.CanReply, ExpiringAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.ExpiringAt), Id = SourceObject.Id, LatestReelMedia = SourceObject.LatestReelMedia, RankedPosition = SourceObject.RankedPosition, Seen = SourceObject.Seen, SeenRankedPosition = SourceObject.SeenRankedPosition, Muted = SourceObject.Muted, SourceToken = SourceObject.SourceToken, PrefetchCount = SourceObject.PrefetchCount, SocialContext = SourceObject.SocialContext }; if (SourceObject.User != null) { story.User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(); } if (SourceObject.Items?.Count > 0) { foreach (var InstaStory in SourceObject.Items) { story.Items.Add(ConvertersFabric.GetStoryItemConverter(InstaStory).Convert()); } } return(story); }
public InstaMedia Convert() { if (SourceObject == null) { throw new ArgumentNullException($"Source object"); } var media = new InstaMedia { InstaIdentifier = SourceObject.InstaIdentifier, Code = SourceObject.Code, Pk = SourceObject.Pk, ClientCacheKey = SourceObject.ClientCacheKey, CommentsCount = SourceObject.CommentsCount, DeviceTimeStap = DateTimeHelper.UnixTimestampToDateTime(SourceObject.DeviceTimeStapUnixLike), HasLiked = SourceObject.HasLiked, PhotoOfYou = SourceObject.PhotoOfYou, TrakingToken = SourceObject.TrakingToken, TakenAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.TakenAtUnixLike), Height = SourceObject.Height, LikesCount = SourceObject.LikesCount, MediaType = SourceObject.MediaType, FilterType = SourceObject.FilterType, Width = SourceObject.Width, HasAudio = SourceObject.HasAudio, ViewCount = int.Parse(SourceObject.ViewCount.ToString(CultureInfo.InvariantCulture)) }; if (SourceObject.CarouselMedia != null) { media.Carousel = ConvertersFabric.GetCarouselConverter(SourceObject.CarouselMedia).Convert(); } if (SourceObject.User != null) { media.User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(); } if (SourceObject.Caption != null) { media.Caption = ConvertersFabric.GetCaptionConverter(SourceObject.Caption).Convert(); } if (SourceObject.NextMaxId != null) { media.NextMaxId = SourceObject.NextMaxId; } if (SourceObject.Likers?.Count > 0) { foreach (var liker in SourceObject.Likers) { media.Likers.Add(ConvertersFabric.GetUserConverter(liker).Convert()); } } if (SourceObject.UserTagList?.In?.Count > 0) { foreach (var tag in SourceObject.UserTagList.In) { media.Tags.Add(ConvertersFabric.GetUserTagConverter(tag).Convert()); } } if (SourceObject.Images?.Candidates == null) { return(media); } foreach (var image in SourceObject.Images.Candidates) { media.Images.Add(new MediaImage(image.Url, int.Parse(image.Width), int.Parse(image.Height))); } return(media); }
public InstaStoryItem Convert() { if (SourceObject == null) { throw new ArgumentNullException($"Source object"); } var instaStory = new InstaStoryItem { CanViewerSave = SourceObject.CanViewerSave, CaptionIsEdited = SourceObject.CaptionIsEdited, CaptionPosition = SourceObject.CaptionPosition, ClientCacheKey = SourceObject.ClientCacheKey, Code = SourceObject.Code, CommentCount = SourceObject.CommentCount, CommentsDisabled = SourceObject.CommentsDisabled, ExpiringAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.ExpiringAt), FilterType = SourceObject.FilterType, HasAudio = SourceObject.HasAudio, HasLiked = SourceObject.HasLiked, HasMoreComments = SourceObject.HasMoreComments, Id = SourceObject.Id, IsReelMedia = SourceObject.IsReelMedia, LikeCount = SourceObject.LikeCount, MaxNumVisiblePreviewComments = SourceObject.MaxNumVisiblePreviewComments, MediaType = SourceObject.MediaType, OriginalHeight = SourceObject.OriginalHeight, OriginalWidth = SourceObject.OriginalWidth, PhotoOfYou = SourceObject.PhotoOfYou, Pk = SourceObject.Pk, TakenAt = DateTimeHelper.UnixTimestampToDateTime(SourceObject.TakenAt), TrackingToken = SourceObject.TrackingToken, VideoDuration = SourceObject.VideoDuration, VideoVersions = SourceObject.VideoVersions }; if (SourceObject.User != null) { instaStory.User = ConvertersFabric.GetUserConverter(SourceObject.User).Convert(); } if (SourceObject.Caption != null) { instaStory.Caption = ConvertersFabric.GetCaptionConverter(SourceObject.Caption).Convert(); } if (SourceObject.Likers?.Count > 0) { foreach (var liker in SourceObject.Likers) { instaStory.Likers.Add(ConvertersFabric.GetUserConverter(liker).Convert()); } } if (SourceObject.CarouselMedia != null) { instaStory.CarouselMedia = ConvertersFabric.GetCarouselConverter(SourceObject.CarouselMedia).Convert(); } if (SourceObject.UserTags?.In?.Count > 0) { foreach (var tag in SourceObject.UserTags.In) { instaStory.UserTags.Add(ConvertersFabric.GetUserTagConverter(tag).Convert()); } } if (SourceObject.ImageVersions?.Candidates != null) { foreach (var image in SourceObject.ImageVersions.Candidates) { instaStory.Images.Add(new MediaImage(image.Url, int.Parse(image.Width), int.Parse(image.Height))); } } return(instaStory); }