Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clarify activity feed type #221

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions InstaSharper/Classes/Models/InstaActivityFeedType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace InstaSharper.Classes.Models
{
public enum InstaActivityFeedType
{
Comment = 12,
Like = 60,
Follow = 101,
TaggedYou = 102,
SupportRequest = 119,
}
}
8 changes: 7 additions & 1 deletion InstaSharper/Classes/Models/InstaRecentActivityFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ 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; }

public string Text { get; set; }

public List<InstaLink> Links { get; set; } = new List<InstaLink>();

public InstaInlineFollow InlineFollow { get; set; }
public int Type { get; set; }

public InstaActivityFeedType Type { get; set; }

public string Pk { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace InstaSharper.Classes.ResponseWrappers
{
public class InstaRecentActivityStoryItemMediaResponse
{
[JsonProperty("id")] public string MediaId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -16,5 +18,7 @@ public class InstaRecentActivityStoryItemResponse
[JsonProperty("text")] public string Text { get; set; }

[JsonProperty("links")] public List<InstaLinkResponse> Links { get; set; }

[JsonProperty("media")] public List<InstaRecentActivityStoryItemMediaResponse> Medias { get; set; }
}
}
9 changes: 6 additions & 3 deletions InstaSharper/Converters/InstaRecentActivityConverter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using InstaSharper.Classes.Models;
using System.Linq;
using InstaSharper.Classes.Models;
using InstaSharper.Classes.ResponseWrappers;
using InstaSharper.Helpers;

Expand All @@ -14,11 +15,13 @@ 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,
Text = SourceObject.Args.Text,
TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp)
MediaId = SourceObject.Args.Medias?.FirstOrDefault()?.MediaId,
TimeStamp = DateTimeHelper.UnixTimestampToDateTime(SourceObject.Args.TimeStamp.Split('.')[0])
};
if (SourceObject.Args.Links != null)
foreach (var instaLinkResponse in SourceObject.Args.Links)
Expand Down