Example #1
0
        /// <summary>
        /// Cross-post this to another subreddit asynchronously.
        /// </summary>
        /// <param name="subreddit">The name of the subreddit being xposted to</param>
        /// <returns>The resulting post data.</returns>
        public async Task <LinkPost> XPostToAsync(string subreddit)
        {
            LinkPost res = this;

            res.Subreddit = subreddit;

            return(Validate(await res.SubmitAsync()));
        }
Example #2
0
        /// <summary>
        /// Cross-post this to another subreddit.
        /// </summary>
        /// <param name="subreddit">The name of the subreddit being xposted to</param>
        /// <returns>The resulting post data.</returns>
        public LinkPost XPostTo(string subreddit)
        {
            LinkPost res = this;

            res.Subreddit = subreddit;

            return(Validate(res.Submit()));
        }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <summary>
        /// Prepare a LinkPost object for cross-posting.
        /// </summary>
        /// <param name="subreddit">The name of the subreddit being xposted to</param>
        /// <param name="creditOriginSub">Whether to include an attribution to the source subreddit in the title (default: true)</param>
        /// <param name="np">Whether to use np.reddit.com as the URL host (default: true)</param>
        /// <returns>The resulting post data.</returns>
        private LinkPost PrepareXLinkPost(string subreddit, bool creditOriginSub = true, bool np = true)
        {
            LinkPost res = new LinkPost(Dispatch, this)
            {
                Subreddit = subreddit
            };

            if (creditOriginSub)
            {
                res.Title += " • r/" + Subreddit;
            }

            res.URL = (np ? res.Permalink.Replace("www.reddit.com", "np.reddit.com") : res.Permalink);

            return(res);
        }
Example #5
0
 /// <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);
 }