diff --git a/src/Reddit.NET/Controllers/Post.cs b/src/Reddit.NET/Controllers/Post.cs index 9a496834..93a962ee 100644 --- a/src/Reddit.NET/Controllers/Post.cs +++ b/src/Reddit.NET/Controllers/Post.cs @@ -352,6 +352,15 @@ private string title } } + public bool IsGallery + { + get + { + return Listing != null && Listing.IsGallery.HasValue && Listing.IsGallery.Value; + } + private set { } + } + /// /// The full Listing object returned by the Reddit API; /// diff --git a/src/Reddit.NET/Things/Post/GalleryData.cs b/src/Reddit.NET/Things/Post/GalleryData.cs new file mode 100644 index 00000000..7207396e --- /dev/null +++ b/src/Reddit.NET/Things/Post/GalleryData.cs @@ -0,0 +1,12 @@ +using System; +using Newtonsoft.Json; + +namespace Reddit.NET.Things.Post +{ + [Serializable] + public class GalleryData + { + [JsonProperty("items")] + public GalleryDataItem[] Items { get; set; } + } +} diff --git a/src/Reddit.NET/Things/Post/GalleryDataItems.cs b/src/Reddit.NET/Things/Post/GalleryDataItems.cs new file mode 100644 index 00000000..58e6185c --- /dev/null +++ b/src/Reddit.NET/Things/Post/GalleryDataItems.cs @@ -0,0 +1,14 @@ +using System; +using Newtonsoft.Json; + +namespace Reddit.NET.Things.Post +{ + [Serializable] + public class GalleryDataItem + { + [JsonProperty("media_id")] + public string MediaId { get; set; } + + public long Id { get; set; } + } +} diff --git a/src/Reddit.NET/Things/Post/MediaMetadataItems.cs b/src/Reddit.NET/Things/Post/MediaMetadataItems.cs new file mode 100644 index 00000000..645d65b5 --- /dev/null +++ b/src/Reddit.NET/Things/Post/MediaMetadataItems.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace Reddit.NET.Things.Post +{ + [Serializable] + public class MediaMetadataItem + { + public string status { get; set; } + public string e { get; set; } + public string m { get; set; } + public List o { get; set; } + public List

p { get; set; } + public S s { get; set; } + public string id { get; set; } + } + + [Serializable] + public class O + { + public int y { get; set; } + public int x { get; set; } + public string u { get; set; } + } + + [Serializable] + public class P + { + public int y { get; set; } + public int x { get; set; } + public string u { get; set; } + } + + [Serializable] + public class S + { + public int y { get; set; } + public int x { get; set; } + public string u { get; set; } + } +} diff --git a/src/Reddit.NET/Things/Post/Post.cs b/src/Reddit.NET/Things/Post/Post.cs index 5ddcae6c..51e74cbc 100644 --- a/src/Reddit.NET/Things/Post/Post.cs +++ b/src/Reddit.NET/Things/Post/Post.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Linq; using Reddit.Controllers; using Reddit.Models.Converters; +using Reddit.NET.Things.Post; using System; using System.Collections.Generic; @@ -326,6 +327,15 @@ public class Post [JsonProperty("is_video")] public bool IsVideo { get; set; } + [JsonProperty("is_gallery")] + public bool? IsGallery { get; set; } + + [JsonProperty("gallery_data")] + public GalleryData GalleryData { get; set; } + + [JsonProperty("media_metadata")] + public Dictionary MediaMetadata { get; set; } + [JsonProperty("sr_detail")] public Subreddit SrDetail { get; set; } diff --git a/src/Reddit.NET/Things/User/UserSubreddit.cs b/src/Reddit.NET/Things/User/UserSubreddit.cs index 5a2cb827..abb47cf4 100644 --- a/src/Reddit.NET/Things/User/UserSubreddit.cs +++ b/src/Reddit.NET/Things/User/UserSubreddit.cs @@ -29,7 +29,7 @@ public class UserSubreddit public string IconColor { get; set; } [JsonProperty("user_is_muted")] - public bool UserIsMuted { get; set; } + public bool? UserIsMuted { get; set; } [JsonProperty("display_name")] public string DisplayName { get; set; }