Reddit.NET  1.5
Reddit.NET is a .NET Standard library that provides easy access to the Reddit API with virtually no boilerplate code required.
Reddit.Controllers.SelfPost Class Reference

Controller class for self posts. More...

Inheritance diagram for Reddit.Controllers.SelfPost:
Reddit.Controllers.Post Reddit.Controllers.Internal.Monitors Reddit.Controllers.BaseController Reddit.Controllers.Internal.Validators

Public Member Functions

 SelfPost (Dispatch dispatch, Things.Post listing)
 Create new SelfPost instance from Reddit API listing. More...
 
 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)
 Create a new SelfPost instance and populate manually. More...
 
 SelfPost (Dispatch dispatch, string fullname)
 Create a new SelfPost instance populated only with its Fullname. Useful for About() queries (e.g. new SelfPost("t3_whatever").About() will retrieve a new SelfPost by its fullname). More...
 
 SelfPost (Dispatch dispatch, string fullname, string subreddit)
 Create a new SelfPost instance populated with its Fullname and Subreddit. More...
 
 SelfPost (Dispatch dispatch, PostResultShortData postResultShortData, SelfPost selfPost)
 Create a new SelfPost instance populated with its Subreddit, an ID/Fullname returned by the API, and other specified values. More...
 
 SelfPost (Dispatch dispatch, LinkPost linkPost)
 Create a new self post controller instance, populated from LinkPost data. More...
 
 SelfPost (Dispatch dispatch)
 Create an empty SelfPost instance. More...
 
void SetSelfText (string value)
 Set the self text manually without any automatic decoding. More...
 
void SetSelfTextHTML (string value)
 Set the self text HTML manually without any automatic decoding. More...
 
SelfPost Submit (bool ad=false, string app="", string extension="", string flairId="", string flairText="", string gRecapthaResponse="", bool sendReplies=true, bool spoiler=false, string videoPosterUrl="")
 Submit this self post to Reddit. More...
 
async Task< SelfPostSubmitAsync (bool ad=false, string app="", string extension="", string flairId="", string flairText="", string gRecapthaResponse="", bool sendReplies=true, bool spoiler=false, string videoPosterUrl="")
 Submit this self post to Reddit asynchronously. This instance will automatically be updated with the resulting fullname/id. More...
 
SelfPost Submit (LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecapthaResponse="")
 Submit this self post to Reddit. More...
 
async Task< SelfPostSubmitAsync (LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecapthaResponse="")
 Submit this self post to Reddit asynchronously. This instance will automatically be updated with the resulting fullname/id. More...
 
SelfPost XPostTo (string subreddit, bool creditOriginSub=true)
 Cross-post this to another subreddit. More...
 
async Task< SelfPostXPostToAsync (string subreddit, bool creditOriginSub=true)
 Cross-post this to another subreddit asynchronously. More...
 
LinkPost XPostToAsLink (string subreddit, bool creditOriginSub=true, bool np=true)
 Link to this post from another subreddit. More...
 
async Task< LinkPostXPostToAsLinkAsync (string subreddit, bool creditOriginSub=true, bool np=true)
 Link to this post from another subreddit asynchronously. More...
 
SelfPost Edit (string text)
 Edit the body text of this self post. This instance will be automatically updated with the return data. More...
 
async Task< SelfPostEditAsync (string text)
 Edit the body text of this self post asynchronously. This instance will be automatically updated with the return data. More...
 
new SelfPost About ()
 Return information about the current SelfPost instance. More...
 
- Public Member Functions inherited from Reddit.Controllers.Post
 Post (Dispatch dispatch, Things.Post listing)
 Create a new post controller instance from API return data. More...
 
 Post (Dispatch dispatch, string subreddit, string title=null, string author=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)
 Create a new post controller instance, populated manually. More...
 
 Post (Dispatch dispatch, string fullname)
 Create a new post controller instance, populated with only its fullname. More...
 
 Post (Dispatch dispatch, string fullname, string subreddit)
 Create a new post controller instance, populated with only its fullname and subreddit. More...
 
 Post (Dispatch dispatch)
 Create an empty post controller instance. More...
 
void SetTitle (string value)
 Set the title manually without any automatic decoding. More...
 
Comment Comment (string body, string bodyHtml=null, string author=null, string collapsedReason=null, bool collapsed=false, bool isSubmitter=false, List< Comment > replies=null, List< More > more=null, bool scoreHidden=false, int depth=0, 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)
 Create a new comment controller instance bound to this post, populated manually. More...
 
Comment Comment ()
 Create a new comment controller instance bound to this post. More...
 
Comment Reply (string body, string bodyHtml=null, string author=null, string collapsedReason=null, bool collapsed=false, bool isSubmitter=false, List< Comment > replies=null, List< More > more=null, bool scoreHidden=false, int depth=0, 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)
 Reply with a comment to this post. More...
 
async Task< CommentReplyAsync (string body, string bodyHtml=null, string author=null, string collapsedReason=null, bool collapsed=false, bool isSubmitter=false, List< Comment > replies=null, List< More > more=null, bool scoreHidden=false, int depth=0, 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)
 Reply with a comment to this post asynchronously. More...
 
Post About ()
 Return information about the current Post instance. More...
 
Post Info ()
 Return information about the current Post instance via the api/info endpoint. More...
 
void SetFlair (string flairText="", string flairTemplateId="")
 Sets the link flair. More...
 
void SetFlair (FlairSelectFlairInput flairSelectFlairInput)
 Sets the link flair. More...
 
Post Distinguish (string how)
 Distinguish a post's author with a sigil. This can be useful to draw attention to and confirm the identity of the user in the context of a link of theirs. The options for distinguish are as follows: yes - add a moderator distinguish([M]). only if the user is a moderator of the subreddit the thing is in. no - remove any distinguishes. admin - add an admin distinguish([A]). admin accounts only. special - add a user-specific distinguish. depends on user. More...
 
async Task< PostDistinguishAsync (string how)
 Distinguish a post's author with a sigil asynchronously. This can be useful to draw attention to and confirm the identity of the user in the context of a link of theirs. The options for distinguish are as follows: yes - add a moderator distinguish([M]). only if the user is a moderator of the subreddit the thing is in. no - remove any distinguishes. admin - add an admin distinguish([A]). admin accounts only. special - add a user-specific distinguish. depends on user. More...
 
void Remove (bool spam=false)
 Remove this post from all subreddit listings. More...
 
async Task RemoveAsync (bool spam=false)
 Asynchronously remove this post from all subreddit listings. More...
 
void Delete ()
 Delete this post. More...
 
async Task DeleteAsync ()
 Delete this post asynchronously. More...
 
void Hide ()
 Hide this post. This removes it from the user's default view of subreddit listings. More...
 
async Task HideAsync ()
 Hide this post asynchronously. This removes it from the user's default view of subreddit listings. More...
 
void Lock ()
 Lock this post. Prevents a post from receiving new comments. More...
 
async Task LockAsync ()
 Lock this post asynchronously. Prevents a post from receiving new comments. More...
 
void MarkNSFW ()
 Mark this post as NSFW. More...
 
async Task MarkNSFWAsync ()
 Mark this post as NSFW asynchronously. More...
 
MoreChildren MoreChildren (string children, bool limitChildren, string sort, string id=null)
 Retrieve additional comments omitted from a base comment tree. When a comment tree is rendered, the most relevant comments are selected for display first. Remaining comments are stubbed out with "MoreComments" links. This API call is used to retrieve the additional comments represented by those stubs, up to 100 at a time. The two core parameters required are link and children. link is the fullname of the link whose comments are being fetched. children is a comma-delimited list of comment ID36s that need to be fetched. If id is passed, it should be the ID of the MoreComments object this call is replacing. This is needed only for the HTML UI's purposes and is optional otherwise. NOTE: you may only make one request at a time to this API endpoint. Higher concurrency will result in an error being returned. If limit_children is True, only return the children requested. More...
 
MoreChildren MoreChildren (LinksAndCommentsMoreChildrenInput linksAndCommentsMoreChildrenInput)
 Retrieve additional comments omitted from a base comment tree. When a comment tree is rendered, the most relevant comments are selected for display first. Remaining comments are stubbed out with "MoreComments" links. This API call is used to retrieve the additional comments represented by those stubs, up to 100 at a time. The two core parameters required are link and children. link is the fullname of the link whose comments are being fetched. children is a comma-delimited list of comment ID36s that need to be fetched. If id is passed, it should be the ID of the MoreComments object this call is replacing. This is needed only for the HTML UI's purposes and is optional otherwise. NOTE: you may only make one request at a time to this API endpoint. Higher concurrency will result in an error being returned. If limit_children is True, only return the children requested. More...
 
void Report (string additionalInfo, string banEvadingAccountsNames, string customText, bool fromHelpCenter, string otherReason, string reason, string ruleReason, string siteReason, string violatorUsername)
 Report this post to the subreddit moderators. The post then becomes implicitly hidden, as well. More...
 
async Task ReportAsync (string additionalInfo, string banEvadingAccountsNames, string customText, bool fromHelpCenter, string otherReason, string reason, string ruleReason, string siteReason, string violatorUsername)
 Report this post to the subreddit moderators asynchronously. The post then becomes implicitly hidden, as well. More...
 
void Report (LinksAndCommentsReportInput linksAndCommentsReportInput)
 Report this post to the subreddit moderators. The post then becomes implicitly hidden, as well. More...
 
async Task ReportAsync (LinksAndCommentsReportInput linksAndCommentsReportInput)
 Report this post to the subreddit moderators asynchronously. The post then becomes implicitly hidden, as well. More...
 
void Save (string category)
 Save this post. Saved things are kept in the user's saved listing for later perusal. More...
 
async Task SaveAsync (string category)
 Save this post asynchronously. Saved things are kept in the user's saved listing for later perusal. More...
 
void EnableSendReplies ()
 Enable inbox replies for this post. More...
 
async Task EnableSendRepliesAsync ()
 Enable inbox replies for this post asynchronously. More...
 
void DisableSendReplies ()
 Disable inbox replies for this post. More...
 
async Task DisableSendRepliesAsync ()
 Disable inbox replies for this post asynchronously. More...
 
void EnableContestMode ()
 Enable contest mode for this post. More...
 
async Task EnableContestModeAsync ()
 Enable contest mode for this post asynchronously. More...
 
void DisableContestMode ()
 Disable contest mode for this post. More...
 
async Task DisableContestModeAsync ()
 Disable contest mode for this post asynchronously. More...
 
void SetSubredditSticky (int num, bool toProfile)
 Set this post as the sticky in its subreddit. The num argument is optional, and only used when stickying a post. It allows specifying a particular "slot" to sticky the post into, and if there is already a post stickied in that slot it will be replaced. If there is no post in the specified slot to replace, or num is None, the bottom-most slot will be used. More...
 
async Task SetSubredditStickyAsync (int num, bool toProfile)
 Set this post as the sticky in its subreddit asynchronously. The num argument is optional, and only used when stickying a post. It allows specifying a particular "slot" to sticky the post into, and if there is already a post stickied in that slot it will be replaced. If there is no post in the specified slot to replace, or num is None, the bottom-most slot will be used. More...
 
void UnsetSubredditSticky (int num, bool toProfile)
 Unset this post as the sticky in its subreddit. The num argument is optional, and only used when stickying a post. It allows specifying a particular "slot" to sticky the post into, and if there is already a post stickied in that slot it will be replaced. If there is no post in the specified slot to replace, or num is None, the bottom-most slot will be used. More...
 
async Task UnsetSubredditStickyAsync (int num, bool toProfile)
 Unset this post as the sticky in its subreddit asynchronously. The num argument is optional, and only used when stickying a post. It allows specifying a particular "slot" to sticky the post into, and if there is already a post stickied in that slot it will be replaced. If there is no post in the specified slot to replace, or num is None, the bottom-most slot will be used. More...
 
void SetSuggestedSort (string sort)
 Set a suggested sort for this post. Suggested sorts are useful to display comments in a certain preferred way for posts. For example, casual conversation may be better sorted by new by default, or AMAs may be sorted by Q&A. A sort of an empty string clears the default sort. More...
 
async Task SetSuggestedSortAsync (string sort)
 Set a suggested sort for this post asynchronously. Suggested sorts are useful to display comments in a certain preferred way for posts. For example, casual conversation may be better sorted by new by default, or AMAs may be sorted by Q&A. A sort of an empty string clears the default sort. More...
 
void Spoiler ()
 Mark this post as containing spoilers. More...
 
async Task SpoilerAsync ()
 Mark this post as containing spoilers asynchronously. More...
 
void Unhide ()
 Unhide this post. More...
 
async Task UnhideAsync ()
 Unhide this post asynchronously. More...
 
void Unlock ()
 Unlock this post. Allows this post to receive new comments. More...
 
async Task UnlockAsync ()
 Unlock this post asynchronously. Allows this post to receive new comments. More...
 
void UnmarkNSFW ()
 Remove the NSFW marking from this post. More...
 
async Task UnmarkNSFWAsync ()
 Remove the NSFW marking from this post asynchronously. More...
 
void Unsave ()
 Unsave this post. This removes the thing from the user's saved listings as well. More...
 
async Task UnsaveAsync ()
 Unsave this post asynchronously. This removes the thing from the user's saved listings as well. More...
 
void Unspoiler ()
 Remove spoiler. More...
 
async Task UnspoilerAsync ()
 Remove spoiler asynchronously. More...
 
void Upvote ()
 Upvote this post. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
async Task UpvoteAsync ()
 Upvote this post asynchronously. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
void Downvote ()
 Downvote this post. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
async Task DownvoteAsync ()
 Downvote this post asynchronously. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
void Unvote ()
 Unvote this post. This is equivalent to "un-voting" by clicking again on a highlighted arrow. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
async Task UnvoteAsync ()
 Unvote this post asynchronously. Please note that votes must be cast by humans. Automated bot-voting violates Reddit's rules. That is, API clients proxying a human's action one-for-one are OK, but bots deciding how to vote on content or amplifying a human's vote are not. See the Reddit rules for more details on what constitutes vote cheating. More...
 
void Approve ()
 Approve this post. If the thing was removed, it will be re-inserted into appropriate listings. Any reports on the approved thing will be discarded. More...
 
FlairSelectorResultContainer FlairSelector (string username)
 Return information about a users's flair options. More...
 
bool MonitorPostData (int? monitoringDelayMs=null, int? monitoringBaseDelayMs=null, List< MonitoringSchedule > schedule=null, bool? breakOnFailure=null, DateTime? monitoringExpiration=null)
 Monitor this post for any configuration changes. More...
 
bool MonitorPostScore (int? monitoringDelayMs=null, int? monitoringBaseDelayMs=null, int? minScoreMonitoringThreshold=null, int? scoreMonitoringPercentThreshold=null, int? cancellationThresholdMinutes=null, List< MonitoringSchedule > schedule=null, bool? breakOnFailure=null, DateTime? monitoringExpiration=null)
 Monitor this post for any score changes. In order for the event to fire, both minScoreMonitoringThreshold AND scoreMonitoringPercentThreshold must be met. More...
 
bool PostDataIsMonitored ()
 Whether post data is being monitored. More...
 
bool PostScoreIsMonitored ()
 Whether post score is being monitored. More...
 
- Public Member Functions inherited from Reddit.Controllers.Internal.Monitors
 Monitors ()
 
void Wait (int ms)
 
bool IsMonitored (string key, string subKey)
 
bool IsScheduled ()
 
void WaitOrDie (string key, int timeout=60)
 
void WaitOrDie (Thread thread, int timeout=60)
 
void KillAllMonitoringThreads ()
 
- Public Member Functions inherited from Reddit.Controllers.BaseController
 BaseController ()
 Create a new Controller instance. More...
 
- Public Member Functions inherited from Reddit.Controllers.Internal.Validators
Exception BuildException (Exception ex, List< List< string >> errors)
 
dynamic Validate (dynamic obj)
 
GenericContainer Validate (GenericContainer genericContainer)
 
Generic Validate (Generic generic)
 
DynamicShortListingContainer Validate (DynamicShortListingContainer dynamicShortListingContainer)
 
DynamicShortListingData Validate (DynamicShortListingData dynamicShortListingData)
 
ImageUploadResult Validate (ImageUploadResult imageUploadResult)
 
LiveUpdateEventContainer Validate (LiveUpdateEventContainer liveUpdateEventContainer)
 
LiveThreadCreateResultContainer Validate (LiveThreadCreateResultContainer liveThreadCreateResultContainer)
 
LiveUpdateContainer Validate (LiveUpdateContainer liveUpdateContainer, int? minChildren=null)
 
SubredditSettingsContainer Validate (SubredditSettingsContainer subredditSettingsContainer)
 
SubredditSettings Validate (SubredditSettings subredditSettings)
 
List< ActionResultValidate (List< ActionResult > actionResults)
 
ActionResult Validate (ActionResult actionResult)
 
FlairListResultContainer Validate (FlairListResultContainer flairListResultContainer)
 
Flair Validate (Flair flair)
 
FlairV2 Validate (FlairV2 flairV2)
 
ModActionContainer Validate (ModActionContainer modActionContainer)
 
ModActionData Validate (ModActionData modActionData)
 
WikiPageRevisionContainer Validate (WikiPageRevisionContainer wikiPageRevisionContainer)
 
WikiPageRevisionData Validate (WikiPageRevisionData wikiPageRevisionData)
 
WikiPageSettingsContainer Validate (WikiPageSettingsContainer wikiPageSettingsContainer)
 
WikiPageSettings Validate (WikiPageSettings wikiPageSettings)
 
List< UserPrefsContainerValidate (List< UserPrefsContainer > userPrefsContainers)
 
UserPrefsContainer Validate (UserPrefsContainer userPrefsContainer)
 
UserPrefsData Validate (UserPrefsData userPrefsData)
 
PostResultShortContainer Validate (PostResultShortContainer postResultShortContainer)
 
PostResultShort Validate (PostResultShort postResultShort)
 
PostResultContainer Validate (PostResultContainer postResultContainer)
 
PostResult Validate (PostResult postResult)
 
JQueryReturn Validate (JQueryReturn jQueryReturn)
 
List<(PostContainer, CommentContainer)> Validate (List<(PostContainer, CommentContainer)> ps)
 
CommentResultContainer Validate (CommentResultContainer commentResultContainer)
 
SubredditContainer Validate (SubredditContainer subredditContainer)
 

Properties

string SelfText [get, set]
 The body of the self post. More...
 
string SelfTextHTML [get, set]
 The body of the self post rendered as HTML. More...
 
- Properties inherited from Reddit.Controllers.Post
string? Subreddit [get, set]
 The subreddit in which the post exists. More...
 
string? Author [get, set]
 The username of the post author. More...
 
string? Id [get, set]
 The ID36 of the post. More...
 
string? Fullname [get, set]
 The fullname of the post. More...
 
string? Permalink [get, set]
 The permalink URL of the post. More...
 
DateTime? Created [get, set]
 When the post was created. More...
 
DateTime? Edited [get, set]
 When the post was last edited. More...
 
bool? Removed [get, set]
 Whether the post was removed. More...
 
bool? Spam [get, set]
 Whether the post was marked as spam. More...
 
bool? NSFW [get, set]
 Whether the post was marked as NSFW. More...
 
int? Score [get, set]
 The post score. More...
 
int? UpVotes [get, set]
 The number of upvotes received. More...
 
double? UpvoteRatio [get, set]
 The number of upvotes received divided by the total number of votes. More...
 
bool IsUpvoted [get]
 Whether the post has been upvoted by the authenticated user. More...
 
bool IsDownvoted [get]
 Whether the post has been downvoted by the authenticated user. More...
 
Awards Awards [get, set]
 Any awards applied to the post. More...
 
int DownVotes [get]
 The number of downvotes received. More...
 
string Title [get, set]
 The title of the post. More...
 
Things.Post Listing [get, set]
 The full Listing object returned by the Reddit API; More...
 
Comments?? Comments [get]
 Comment replies to this post. More...
 
- Properties inherited from Reddit.Controllers.Internal.Monitors
IDictionary< string, HashSet< string > > MonitoringCache [get, set]
 An optional cache for preventing the same post from appearing multiple times during monitoring. See: https://github.com/sirkris/Reddit.NET/issues/117#issuecomment-759501039 More...
 
- Properties inherited from Reddit.Controllers.BaseController
Lists Lists [get, set]
 List-handling. More...
 

Additional Inherited Members

- Public Attributes inherited from Reddit.Controllers.Internal.Monitors
int MonitoringWaitDelayMS = 1500
 
- Protected Member Functions inherited from Reddit.Controllers.Post
virtual void OnPostDataUpdated (PostUpdateEventArgs e)
 Invoke monitoring event for post data. More...
 
virtual void OnPostScoreUpdated (PostUpdateEventArgs e)
 Invoke monitoring event for post score. More...
 
override Thread CreateMonitoringThread (string key, string subKey, int startDelayMs=0, int? monitoringDelayMs=null)
 Creates a new monitoring thread. More...
 
- Protected Member Functions inherited from Reddit.Controllers.Internal.Monitors
bool Monitor (string key, Thread thread, string subKey)
 
void RebuildThreads (string subKey)
 
void LaunchThreadIfNotNull (string key, Thread thread)
 
void KillThread (Thread thread)
 
void KillThread (string key)
 
void ResetThreads (List< string > oldThreads)
 
- Protected Member Functions inherited from Reddit.Controllers.Internal.Validators
void CheckErrors (List< List< string >> errors)
 
void CheckErrors (List< string > errors)
 
void CheckNull (object res, string msg="Reddit API returned null response.")
 
- Protected Attributes inherited from Reddit.Controllers.Internal.Monitors
volatile bool Terminate = false
 
- Events inherited from Reddit.Controllers.Post
EventHandler< PostUpdateEventArgsPostDataUpdated
 Event handler for monitoring post data. More...
 
EventHandler< PostUpdateEventArgsPostScoreUpdated
 Event handler for monitoring post score. More...
 

Detailed Description

Controller class for self posts.

Constructor & Destructor Documentation

◆ SelfPost() [1/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch,
Things.Post  listing 
)

Create new SelfPost instance from Reddit API listing.

Parameters
dispatchAn instance of the Dispatch controller
listingListing returned by Reddit API.

◆ SelfPost() [2/7]

Reddit.Controllers.SelfPost.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 
)

Create a new SelfPost instance and populate manually.

Parameters
dispatchAn instance of the Dispatch controller
subredditThe subreddit the post belongs to.
titlePost title.
authorReddit user who authored the post.
selfTextThe post body.
selfTextHtmlThe HTML-formateed post body.
idPost ID.
fullnamePost fullname.
permalinkPermalink of post.
createdWhen the post was created.
editedWhen the post was last edited.
scoreNet vote score.
upVotesNumber of upvotes.
downVotesNumber of downvotes.
removedWhether the post was removed.
spamWhether the post was marked as spam.

◆ SelfPost() [3/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch,
string  fullname 
)

Create a new SelfPost instance populated only with its Fullname. Useful for About() queries (e.g. new SelfPost("t3_whatever").About() will retrieve a new SelfPost by its fullname).

Parameters
dispatchAn instance of the Dispatch controller
fullnamefullname of a thing

◆ SelfPost() [4/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch,
string  fullname,
string  subreddit 
)

Create a new SelfPost instance populated with its Fullname and Subreddit.

Parameters
dispatchAn instance of the Dispatch controller
fullnamefullname of a thing
subredditThe subreddit where the post exists

◆ SelfPost() [5/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch,
PostResultShortData  postResultShortData,
SelfPost  selfPost 
)

Create a new SelfPost instance populated with its Subreddit, an ID/Fullname returned by the API, and other specified values.

Parameters
dispatchAn instance of the Dispatch controller
postResultShortDataData returned by the Reddit API when creating a new post
selfPostThe SelfPost instance that executed the submission

◆ SelfPost() [6/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch,
LinkPost  linkPost 
)

Create a new self post controller instance, populated from LinkPost data.

Parameters
dispatch
linkPost

◆ SelfPost() [7/7]

Reddit.Controllers.SelfPost.SelfPost ( Dispatch  dispatch)

Create an empty SelfPost instance.

Parameters
dispatchAn instance of the Dispatch controller

Member Function Documentation

◆ About()

new SelfPost Reddit.Controllers.SelfPost.About ( )

Return information about the current SelfPost instance.

Returns
An instance of this class populated with the retrieved data.

◆ Edit()

SelfPost Reddit.Controllers.SelfPost.Edit ( string  text)

Edit the body text of this self post. This instance will be automatically updated with the return data.

Parameters
textraw markdown text
Returns
This instance populated with the modified post data returned by the API.

◆ EditAsync()

async Task<SelfPost> Reddit.Controllers.SelfPost.EditAsync ( string  text)

Edit the body text of this self post asynchronously. This instance will be automatically updated with the return data.

Parameters
textraw markdown text

◆ SetSelfText()

void Reddit.Controllers.SelfPost.SetSelfText ( string  value)

Set the self text manually without any automatic decoding.

Parameters
valueThe self text value you wish to set

◆ SetSelfTextHTML()

void Reddit.Controllers.SelfPost.SetSelfTextHTML ( string  value)

Set the self text HTML manually without any automatic decoding.

Parameters
valueThe self text HTML value you wish to set

◆ Submit() [1/2]

SelfPost Reddit.Controllers.SelfPost.Submit ( bool  ad = false,
string  app = "",
string  extension = "",
string  flairId = "",
string  flairText = "",
string  gRecapthaResponse = "",
bool  sendReplies = true,
bool  spoiler = false,
string  videoPosterUrl = "" 
)

Submit this self post to Reddit.

Parameters
adboolean value
app
extensionextension used for redirects
flairIda string no longer than 36 characters
flairTexta string no longer than 64 characters
gRecapthaResponse
sendRepliesboolean value
spoilerboolean value
videoPosterUrla valid URL
Returns
A copy of this instance populated with the ID and Fullname returned by the API.

◆ Submit() [2/2]

SelfPost Reddit.Controllers.SelfPost.Submit ( LinksAndCommentsSubmitInput  linksAndCommentsSubmitInput,
string  gRecapthaResponse = "" 
)

Submit this self post to Reddit.

Parameters
linksAndCommentsSubmitInputA valid LinksAndCommentsSubmitInput instance
gRecapthaResponse
Returns
A copy of this instance populated with the ID and Fullname returned by the API.

◆ SubmitAsync() [1/2]

async Task<SelfPost> Reddit.Controllers.SelfPost.SubmitAsync ( bool  ad = false,
string  app = "",
string  extension = "",
string  flairId = "",
string  flairText = "",
string  gRecapthaResponse = "",
bool  sendReplies = true,
bool  spoiler = false,
string  videoPosterUrl = "" 
)

Submit this self post to Reddit asynchronously. This instance will automatically be updated with the resulting fullname/id.

Parameters
adboolean value
app
extensionextension used for redirects
flairIda string no longer than 36 characters
flairTexta string no longer than 64 characters
gRecapthaResponse
sendRepliesboolean value
spoilerboolean value
videoPosterUrla valid URL

◆ SubmitAsync() [2/2]

async Task<SelfPost> Reddit.Controllers.SelfPost.SubmitAsync ( LinksAndCommentsSubmitInput  linksAndCommentsSubmitInput,
string  gRecapthaResponse = "" 
)

Submit this self post to Reddit asynchronously. This instance will automatically be updated with the resulting fullname/id.

Parameters
linksAndCommentsSubmitInputA valid LinksAndCommentsSubmitInput instance
gRecapthaResponse

◆ XPostTo()

SelfPost Reddit.Controllers.SelfPost.XPostTo ( string  subreddit,
bool  creditOriginSub = true 
)

Cross-post this to another subreddit.

Parameters
subredditThe name of the subreddit being xposted to
creditOriginSubWhether to include an attribution to the source subreddit in the title (default: true)
Returns
The resulting post data.

◆ XPostToAsLink()

LinkPost Reddit.Controllers.SelfPost.XPostToAsLink ( string  subreddit,
bool  creditOriginSub = true,
bool  np = true 
)

Link to this post from another subreddit.

Parameters
subredditThe name of the subreddit being xposted to
creditOriginSubWhether to include an attribution to the source subreddit in the title (default: true)
npWhether to use np.reddit.com as the URL host (default: true)
Returns
The resulting post data.

◆ XPostToAsLinkAsync()

async Task<LinkPost> Reddit.Controllers.SelfPost.XPostToAsLinkAsync ( string  subreddit,
bool  creditOriginSub = true,
bool  np = true 
)

Link to this post from another subreddit asynchronously.

Parameters
subredditThe name of the subreddit being xposted to
creditOriginSubWhether to include an attribution to the source subreddit in the title (default: true)
npWhether to use np.reddit.com as the URL host (default: true)
Returns
The resulting post data.

◆ XPostToAsync()

async Task<SelfPost> Reddit.Controllers.SelfPost.XPostToAsync ( string  subreddit,
bool  creditOriginSub = true 
)

Cross-post this to another subreddit asynchronously.

Parameters
subredditThe name of the subreddit being xposted to
creditOriginSubWhether to include an attribution to the source subreddit in the title (default: true)
Returns
The resulting post data.

Property Documentation

◆ SelfText

string Reddit.Controllers.SelfPost.SelfText
getset

The body of the self post.

◆ SelfTextHTML

string Reddit.Controllers.SelfPost.SelfTextHTML
getset

The body of the self post rendered as HTML.


The documentation for this class was generated from the following file: