/// <summary> /// Create a new link post controller instance from API return data. /// </summary> /// <param name="dispatch"></param> /// <param name="listing"></param> public LinkPost(Dispatch dispatch, Things.Post listing) : base(dispatch, listing) { Preview = listing.Preview; URL = listing.URL; Thumbnail = listing.Thumbnail; ThumbnailHeight = listing.ThumbnailHeight; ThumbnailWidth = listing.ThumbnailWidth; }
/// <summary> /// Initialize the Awards controller from a post. /// </summary> /// <param name="post">A valid Things.Post instance</param> public Awards(Things.Post post) { if (post.Gildings != null) { Silver = (post.Gildings.ContainsKey("gid_1") ? post.Gildings["gid_1"] : 0); Gold = (post.Gildings.ContainsKey("gid_2") ? post.Gildings["gid_2"] : 0); Platinum = (post.Gildings.ContainsKey("gid_3") ? post.Gildings["gid_3"] : 0); } }
/// <summary> /// Create a new SelfPost instance populated with its Subreddit, an ID/Fullname returned by the API, and other specified values. /// </summary> /// <param name="dispatch">An instance of the Dispatch controller</param> /// <param name="postResultShortData">Data returned by the Reddit API when creating a new post</param> /// <param name="selfPost">The SelfPost instance that executed the submission</param> public SelfPost(Dispatch dispatch, PostResultShortData postResultShortData, SelfPost selfPost) : base(dispatch, selfPost.Subreddit, selfPost.Title, selfPost.Author, postResultShortData.Id, postResultShortData.Name, selfPost.Permalink, selfPost.Created, selfPost.Edited, selfPost.Score, selfPost.UpVotes, selfPost.DownVotes, selfPost.Removed, selfPost.Spam, selfPost.NSFW) { SelfText = selfPost.SelfText; SelfTextHTML = selfPost.SelfTextHTML; Listing = new Things.Post(this); }
/// <summary> /// Create a new SelfPost instance and populate manually. /// </summary> /// <param name="dispatch">An instance of the Dispatch controller</param> /// <param name="subreddit">The subreddit the post belongs to.</param> /// <param name="title">Post title.</param> /// <param name="author">Reddit user who authored the post.</param> /// <param name="selfText">The post body.</param> /// <param name="selfTextHtml">The HTML-formateed post body.</param> /// <param name="id">Post ID.</param> /// <param name="fullname">Post fullname.</param> /// <param name="permalink">Permalink of post.</param> /// <param name="created">When the post was created.</param> /// <param name="edited">When the post was last edited.</param> /// <param name="score">Net vote score.</param> /// <param name="upVotes">Number of upvotes.</param> /// <param name="downVotes">Number of downvotes.</param> /// <param name="removed">Whether the post was removed.</param> /// <param name="spam">Whether the post was marked as spam.</param> public SelfPost(Dispatch dispatch, string subreddit, string title, string author, string selfText, string selfTextHtml, string id = null, string fullname = null, string permalink = null, DateTime created = default(DateTime), DateTime edited = default(DateTime), int score = 0, int upVotes = 0, int downVotes = 0, bool removed = false, bool spam = false) : base(dispatch, subreddit, title, author, id, fullname, permalink, created, edited, score, upVotes, downVotes, removed, spam) { SelfText = selfText; SelfTextHTML = selfTextHtml; Listing = new Things.Post(this); }
/// <summary> /// Create a new link post controller instance, populated from post result data. /// </summary> /// <param name="dispatch"></param> /// <param name="postResultShortData"></param> /// <param name="linkPost"></param> public LinkPost(Dispatch dispatch, PostResultShortData postResultShortData, LinkPost linkPost) : base(dispatch, linkPost.Subreddit, linkPost.Title, linkPost.Author, postResultShortData.Id, postResultShortData.Name, linkPost.Permalink, linkPost.Created, linkPost.Edited, linkPost.Score, linkPost.UpVotes, linkPost.DownVotes, linkPost.Removed, linkPost.Spam, linkPost.NSFW) { Preview = linkPost.Preview; URL = linkPost.URL; Thumbnail = linkPost.Thumbnail; ThumbnailHeight = linkPost.ThumbnailHeight; ThumbnailWidth = linkPost.ThumbnailWidth; Listing = new Things.Post(this); }
/// <summary> /// Create a new link post controller instance, populated manually. /// </summary> /// <param name="dispatch"></param> /// <param name="subreddit">The subreddit to which the post belongs</param> /// <param name="title">The title of the post</param> /// <param name="author">The post author's username</param> /// <param name="url">The link post URL</param> /// <param name="thumbnail"></param> /// <param name="thumbnailHeight"></param> /// <param name="thumbnailWidth"></param> /// <param name="preview"></param> /// <param name="id"></param> /// <param name="fullname"></param> /// <param name="permalink"></param> /// <param name="created"></param> /// <param name="edited"></param> /// <param name="score"></param> /// <param name="upVotes"></param> /// <param name="downVotes"></param> /// <param name="removed"></param> /// <param name="spam"></param> /// <param name="nsfw"></param> public LinkPost(Dispatch dispatch, string subreddit, string title, string author, string url, string thumbnail = null, int?thumbnailHeight = null, int?thumbnailWidth = null, JObject preview = null, string id = null, string fullname = null, string permalink = null, DateTime created = default(DateTime), DateTime edited = default(DateTime), int score = 0, int upVotes = 0, int downVotes = 0, bool removed = false, bool spam = false, bool nsfw = false) : base(dispatch, subreddit, title, author, id, fullname, permalink, created, edited, score, upVotes, downVotes, removed, spam, nsfw) { Preview = preview; URL = url; Thumbnail = thumbnail; ThumbnailHeight = thumbnailHeight; ThumbnailWidth = thumbnailWidth; Listing = new Things.Post(this); }
internal void Import(Things.Post listing) { Subreddit = listing.Subreddit; Title = listing.Title; Author = listing.Author; Id = listing.Id; Fullname = listing.Name; Permalink = listing.Permalink; Created = listing.Created; Edited = listing.Edited; Score = listing.Score; UpVotes = listing.Ups; DownVotes = listing.Downs; Removed = listing.Removed; Spam = listing.Spam; NSFW = listing.Over18; Listing = listing; }
internal void Import(string subreddit, string title, string author, string id = null, string fullname = null, string permalink = null, DateTime created = default(DateTime), DateTime edited = default(DateTime), int score = 0, int upVotes = 0, int downVotes = 0, bool removed = false, bool spam = false, bool nsfw = false) { Subreddit = subreddit; Title = title; Author = author; Id = id; Fullname = fullname; Permalink = permalink; Created = created; Edited = edited; Score = score; UpVotes = upVotes; DownVotes = downVotes; Removed = removed; Spam = spam; NSFW = nsfw; Listing = new Things.Post(this); }
/// <summary> /// Create a new link post controller instance, populated from SelfPost data. /// </summary> /// <param name="dispatch"></param> /// <param name="selfPost"></param> public LinkPost(Dispatch dispatch, SelfPost selfPost) : base(dispatch, selfPost.Subreddit, selfPost.Title, selfPost.Author, nsfw: selfPost.NSFW) { Listing = new Things.Post(this); }
/// <summary> /// Create new SelfPost instance from Reddit API listing. /// </summary> /// <param name="dispatch">An instance of the Dispatch controller</param> /// <param name="listing">Listing returned by Reddit API.</param> public SelfPost(Dispatch dispatch, Things.Post listing) : base(dispatch, listing) { SelfText = listing.SelfText; SelfTextHTML = listing.SelfTextHTML; }
/// <summary> /// Create a new self post controller instance, populated from LinkPost data. /// </summary> /// <param name="dispatch"></param> /// <param name="linkPost"></param> public SelfPost(Dispatch dispatch, LinkPost linkPost) : base(dispatch, linkPost.Subreddit, linkPost.Title, linkPost.Author, nsfw: linkPost.NSFW) { Listing = new Things.Post(this); }
/// <summary> /// Create a new post controller instance from API return data. /// </summary> /// <param name="dispatch"></param> /// <param name="listing"></param> public Post(Dispatch dispatch, Things.Post listing) { Dispatch = dispatch; Import(listing); }
/// <summary> /// Create a new link post controller instance from API return data. /// </summary> /// <param name="dispatch"></param> /// <param name="listing"></param> public LinkPost(Dispatch dispatch, Things.Post listing) : base(dispatch, listing) { }