Skip to content
Draft
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
9 changes: 9 additions & 0 deletions src/Reddit.NET/Controllers/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,15 @@ private string title
}
}

public bool IsGallery
{
get
{
return Listing != null && Listing.IsGallery.HasValue && Listing.IsGallery.Value;
}
private set { }
}

/// <summary>
/// The full Listing object returned by the Reddit API;
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Reddit.NET/Things/Post/GalleryData.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
14 changes: 14 additions & 0 deletions src/Reddit.NET/Things/Post/GalleryDataItems.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
41 changes: 41 additions & 0 deletions src/Reddit.NET/Things/Post/MediaMetadataItems.cs
Original file line number Diff line number Diff line change
@@ -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> o { get; set; }
public List<P> 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; }
}
}
10 changes: 10 additions & 0 deletions src/Reddit.NET/Things/Post/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<string, MediaMetadataItem> MediaMetadata { get; set; }

[JsonProperty("sr_detail")]
public Subreddit SrDetail { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Reddit.NET/Things/User/UserSubreddit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down