예제 #1
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 SelfPost XPostTo(string subreddit)
        {
            SelfPost res = this;

            res.Subreddit = subreddit;

            return(Validate(res.Submit()));
        }
예제 #2
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);
        }
예제 #3
0
        /// <summary>
        /// Cross-post this to another subreddit asynchronously.
        /// </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>
        /// <returns>The resulting post data.</returns>
        public async Task <SelfPost> XPostToAsync(string subreddit, bool creditOriginSub = true)
        {
            SelfPost res = this;

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

            return(Validate(await res.SubmitAsync()));
        }
예제 #4
0
        /// <summary>
        /// Cross-post this to another subreddit.
        /// </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>
        /// <returns>The resulting post data.</returns>
        public SelfPost XPostTo(string subreddit, bool creditOriginSub = true)
        {
            SelfPost res = this;

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

            return(Validate(res.Submit()));
        }
예제 #5
0
 /// <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);
 }