From 6dd9737d1688e5388033bb91aa0f9cdb0c0b72e6 Mon Sep 17 00:00:00 2001 From: Anton Zelinsky Date: Wed, 30 Jan 2019 22:13:45 +0300 Subject: [PATCH 1/3] Fixed bug with time in recent activities --- InstaSharper/Converters/InstaRecentActivityConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InstaSharper/Converters/InstaRecentActivityConverter.cs b/InstaSharper/Converters/InstaRecentActivityConverter.cs index 7c81c0f5..f48b599d 100644 --- a/InstaSharper/Converters/InstaRecentActivityConverter.cs +++ b/InstaSharper/Converters/InstaRecentActivityConverter.cs @@ -18,7 +18,7 @@ public InstaRecentActivityFeed Convert() ProfileId = SourceObject.Args.ProfileId, ProfileImage = SourceObject.Args.ProfileImage, Text = SourceObject.Args.Text, - TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp) + TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp.Split('.')[0]) }; if (SourceObject.Args.Links != null) foreach (var instaLinkResponse in SourceObject.Args.Links) From deb91bb5a61c9fd5e437c66cfccf2e992f1388ac Mon Sep 17 00:00:00 2001 From: Anton Zelinsky Date: Thu, 31 Jan 2019 01:36:17 +0300 Subject: [PATCH 2/3] Added missed fields --- InstaSharper/Classes/Models/InstaRecentActivityFeed.cs | 4 ++++ .../InstaRecentActivityStoryItemMediaResponse.cs | 9 +++++++++ .../InstaRecentActivityStoryItemResponse.cs | 4 ++++ InstaSharper/Converters/InstaRecentActivityConverter.cs | 5 ++++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemMediaResponse.cs diff --git a/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs b/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs index 11786cd7..83ac5832 100644 --- a/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs +++ b/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs @@ -5,8 +5,12 @@ namespace InstaSharper.Classes.Models { public class InstaRecentActivityFeed { + public string MediaId { get; set; } + public long ProfileId { get; set; } + public string ProfileName { get; set; } + public string ProfileImage { get; set; } public DateTime TimeStamp { get; set; } diff --git a/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemMediaResponse.cs b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemMediaResponse.cs new file mode 100644 index 00000000..e3849385 --- /dev/null +++ b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemMediaResponse.cs @@ -0,0 +1,9 @@ +using Newtonsoft.Json; + +namespace InstaSharper.Classes.ResponseWrappers +{ + public class InstaRecentActivityStoryItemMediaResponse + { + [JsonProperty("id")] public string MediaId { get; set; } + } +} \ No newline at end of file diff --git a/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemResponse.cs b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemResponse.cs index b2021454..069ff12b 100644 --- a/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemResponse.cs +++ b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityStoryItemResponse.cs @@ -7,6 +7,8 @@ public class InstaRecentActivityStoryItemResponse { [JsonProperty("profile_id")] public long ProfileId { get; set; } + [JsonProperty("profile_name")] public string ProfileName { get; set; } + [JsonProperty("profile_image")] public string ProfileImage { get; set; } [JsonProperty("timestamp")] public string TimeStamp { get; set; } @@ -16,5 +18,7 @@ public class InstaRecentActivityStoryItemResponse [JsonProperty("text")] public string Text { get; set; } [JsonProperty("links")] public List Links { get; set; } + + [JsonProperty("media")] public List Medias { get; set; } } } \ No newline at end of file diff --git a/InstaSharper/Converters/InstaRecentActivityConverter.cs b/InstaSharper/Converters/InstaRecentActivityConverter.cs index f48b599d..d3a480b4 100644 --- a/InstaSharper/Converters/InstaRecentActivityConverter.cs +++ b/InstaSharper/Converters/InstaRecentActivityConverter.cs @@ -1,4 +1,5 @@ -using InstaSharper.Classes.Models; +using System.Linq; +using InstaSharper.Classes.Models; using InstaSharper.Classes.ResponseWrappers; using InstaSharper.Helpers; @@ -16,8 +17,10 @@ public InstaRecentActivityFeed Convert() Pk = SourceObject.Pk, Type = SourceObject.Type, ProfileId = SourceObject.Args.ProfileId, + ProfileName = SourceObject.Args.ProfileName, ProfileImage = SourceObject.Args.ProfileImage, Text = SourceObject.Args.Text, + MediaId = SourceObject.Args.Medias?.FirstOrDefault()?.MediaId, TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp.Split('.')[0]) }; if (SourceObject.Args.Links != null) From 8fb7a2a2418b5116cec909d5fbea2bfd536aed85 Mon Sep 17 00:00:00 2001 From: Anton Zelinsky Date: Sat, 2 Feb 2019 00:01:01 +0300 Subject: [PATCH 3/3] Added clarify activity feed type --- InstaSharper/Classes/Models/InstaActivityFeedType.cs | 11 +++++++++++ .../Classes/Models/InstaRecentActivityFeed.cs | 4 +++- .../InstaRecentActivityFeedResponse.cs | 2 +- .../Converters/InstaRecentActivityConverter.cs | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 InstaSharper/Classes/Models/InstaActivityFeedType.cs diff --git a/InstaSharper/Classes/Models/InstaActivityFeedType.cs b/InstaSharper/Classes/Models/InstaActivityFeedType.cs new file mode 100644 index 00000000..0a7b7056 --- /dev/null +++ b/InstaSharper/Classes/Models/InstaActivityFeedType.cs @@ -0,0 +1,11 @@ +namespace InstaSharper.Classes.Models +{ + public enum InstaActivityFeedType + { + Comment = 12, + Like = 60, + Follow = 101, + TaggedYou = 102, + SupportRequest = 119, + } +} \ No newline at end of file diff --git a/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs b/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs index 83ac5832..ca54c906 100644 --- a/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs +++ b/InstaSharper/Classes/Models/InstaRecentActivityFeed.cs @@ -18,8 +18,10 @@ public class InstaRecentActivityFeed public string Text { get; set; } public List Links { get; set; } = new List(); + public InstaInlineFollow InlineFollow { get; set; } - public int Type { get; set; } + + public InstaActivityFeedType Type { get; set; } public string Pk { get; set; } } diff --git a/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityFeedResponse.cs b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityFeedResponse.cs index 6ee98531..d1b29ea3 100644 --- a/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityFeedResponse.cs +++ b/InstaSharper/Classes/ResponseWrappers/InstaRecentActivityFeedResponse.cs @@ -6,7 +6,7 @@ public class InstaRecentActivityFeedResponse { [JsonProperty("args")] public InstaRecentActivityStoryItemResponse Args { get; set; } - [JsonProperty("type")] public int Type { get; set; } + [JsonProperty("story_type")] public int Type { get; set; } [JsonProperty("pk")] public string Pk { get; set; } } diff --git a/InstaSharper/Converters/InstaRecentActivityConverter.cs b/InstaSharper/Converters/InstaRecentActivityConverter.cs index d3a480b4..cd9518ea 100644 --- a/InstaSharper/Converters/InstaRecentActivityConverter.cs +++ b/InstaSharper/Converters/InstaRecentActivityConverter.cs @@ -15,7 +15,7 @@ public InstaRecentActivityFeed Convert() var activityStory = new InstaRecentActivityFeed { Pk = SourceObject.Pk, - Type = SourceObject.Type, + Type = (InstaActivityFeedType) SourceObject.Type, ProfileId = SourceObject.Args.ProfileId, ProfileName = SourceObject.Args.ProfileName, ProfileImage = SourceObject.Args.ProfileImage,