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.WikiPage Class Reference

Controller class for wiki pages. More...

Inheritance diagram for Reddit.Controllers.WikiPage:
Reddit.Controllers.Internal.Monitors Reddit.Controllers.BaseController Reddit.Controllers.Internal.Validators

Public Member Functions

 WikiPage (Dispatch dispatch, bool mayRevise, DateTime revisionDate, string contentHtml, User revisionBy, string contentMd, string subreddit=null, string name=null)
 Create a new wiki page controller instance, populated manually. More...
 
 WikiPage (Dispatch dispatch, Things.WikiPage wikiPage, string subreddit=null, string name=null)
 Create a new wiki page controller instance from API return data. More...
 
 WikiPage (Dispatch dispatch, string subreddit=null, string name=null)
 Create a new wiki page controller instance, populated only with subreddit and name. More...
 
 WikiPage (Dispatch dispatch)
 Create an empty wiki page controller instance. More...
 
void AllowEditor (string username)
 Allow username to edit this wiki page. More...
 
async Task AllowEditorAsync (string username)
 Asynchronously allow username to edit this wiki page. More...
 
void DenyEditor (string username)
 Deny username to edit this wiki page. More...
 
async Task DenyEditorAsync (string username)
 Asynchronously deny username to edit this wiki page. More...
 
WikiPage EditAndReturn (string reason, string content=null, string previous="")
 Edit a wiki page and return an instance with the updated data. More...
 
WikiPage EditAndReturn (WikiEditPageInput wikiEditPageInput)
 Edit a wiki page and return an instance with the updated data. More...
 
void Edit (string reason, string content=null, string previous="")
 Edit this wiki page. More...
 
async Task EditAsync (string reason, string content=null, string previous="")
 Edit this wiki page asynchronously. More...
 
void Edit (WikiEditPageInput wikiEditPageInput)
 Edit this wiki page. More...
 
async Task EditAsync (WikiEditPageInput wikiEditPageInput)
 Edit this wiki page asynchronously. More...
 
void SaveChanges (string reason, string previous="")
 Edit this wiki page with the current values of this instance. More...
 
async Task SaveChangesAsync (string reason, string previous="")
 Edit this wiki page with the current values of this instance asynchronously. More...
 
WikiPage CreateAndReturn (string reason, string content=null)
 Create a new wiki page and return an instance with the updated data. More...
 
void Create (string reason, string content=null)
 Create a new wiki page. More...
 
async Task CreateAsync (string reason, string content=null)
 Create a new wiki page asynchronously. More...
 
bool Hide (string revision)
 Toggle the public visibility of a wiki page revision. More...
 
async Task< bool > HideAsync (string revision)
 Toggle the public visibility of a wiki page revision asynchronously. More...
 
void Revert (string revision)
 Revert a wiki page to revision. More...
 
WikiPage RevertAndReturn (string revision)
 Revert a wiki page to revision and return an instance with the updated data. More...
 
async Task RevertAsync (string revision)
 Revert a wiki page to revision asynchronously. More...
 
List< WikiPageRevisionRevisions (int limit=25, string after="", string before="", string show="all", bool srDetail=false, int count=0)
 Retrieve a list of revisions of this wiki page. More...
 
List< WikiPageRevisionRevisions (SrListingInput srListingInput)
 Retrieve a list of revisions of this wiki page. More...
 
WikiPageSettings GetPermissions ()
 Retrieve the current permission settings for page. More...
 
WikiPageSettings UpdatePermissions (bool listed, int permLevel)
 Update the permissions and visibility of wiki page. More...
 
async Task< WikiPageSettingsUpdatePermissionsAsync (bool listed, int permLevel)
 Update the permissions and visibility of wiki page asynchronously. More...
 
WikiPageSettings UpdatePermissions (WikiUpdatePermissionsInput wikiUpdatePermissionsInput)
 Update the permissions and visibility of wiki page. More...
 
async Task< WikiPageSettingsUpdatePermissionsAsync (WikiUpdatePermissionsInput wikiUpdatePermissionsInput)
 Update the permissions and visibility of wiki page asynchronously. More...
 
WikiPageSettings UpdatePermissions (WikiPageSettings wikiPageSettings)
 Update the permissions and visibility of wiki page. More...
 
async Task< WikiPageSettingsUpdatePermissionsAsync (WikiPageSettings wikiPageSettings)
 Update the permissions and visibility of wiki page asynchronously. More...
 
WikiPage About (string v="", string v2="")
 Return the content of a wiki page. If v is given, show the wiki page as it was at that version If both v and v2 are given, show a diff of the two. More...
 
bool MonitorPage (int? monitoringDelayMs=null, int? monitoringBaseDelayMs=null, List< MonitoringSchedule > schedule=null, bool? breakOnFailure=null, DateTime? monitoringExpiration=null)
 Monitor this wiki page for any changes. More...
 
bool WikiPagesIsMonitored ()
 Whether updates to this wiki page are 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)
 

Protected Member Functions

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.")
 

Properties

bool MayRevise [get, set]
 Whether the authenticated user can edit this page. More...
 
DateTime RevisionDate [get, set]
 The current revision date. More...
 
string ContentHTML [get, set]
 The page content rendered as HTML. More...
 
User RevisionBy [get, set]
 The user who authored the current revision. More...
 
string ContentMd [get, set]
 The page content. More...
 
string Name [get, set]
 The page name. More...
 
string Subreddit [get, set]
 The name of the subreddit this wiki belongs to. 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...
 

Events

EventHandler< WikiPageUpdateEventArgsPageUpdated
 Event handler for monitoring update to this wiki page. More...
 

Additional Inherited Members

- Public Attributes inherited from Reddit.Controllers.Internal.Monitors
int MonitoringWaitDelayMS = 1500
 
- Protected Attributes inherited from Reddit.Controllers.Internal.Monitors
volatile bool Terminate = false
 

Detailed Description

Controller class for wiki pages.

Constructor & Destructor Documentation

◆ WikiPage() [1/4]

Reddit.Controllers.WikiPage.WikiPage ( Dispatch  dispatch,
bool  mayRevise,
DateTime  revisionDate,
string  contentHtml,
User  revisionBy,
string  contentMd,
string  subreddit = null,
string  name = null 
)

Create a new wiki page controller instance, populated manually.

Parameters
dispatch
mayRevise
revisionDate
contentHtml
revisionBy
contentMd
subreddit
name

◆ WikiPage() [2/4]

Reddit.Controllers.WikiPage.WikiPage ( Dispatch  dispatch,
Things.WikiPage  wikiPage,
string  subreddit = null,
string  name = null 
)

Create a new wiki page controller instance from API return data.

Parameters
dispatch
wikiPage
subreddit
name

◆ WikiPage() [3/4]

Reddit.Controllers.WikiPage.WikiPage ( Dispatch  dispatch,
string  subreddit = null,
string  name = null 
)

Create a new wiki page controller instance, populated only with subreddit and name.

Parameters
dispatch
subreddit
name

◆ WikiPage() [4/4]

Reddit.Controllers.WikiPage.WikiPage ( Dispatch  dispatch)

Create an empty wiki page controller instance.

Parameters
dispatch

Member Function Documentation

◆ About()

WikiPage Reddit.Controllers.WikiPage.About ( string  v = "",
string  v2 = "" 
)

Return the content of a wiki page. If v is given, show the wiki page as it was at that version If both v and v2 are given, show a diff of the two.

Parameters
va wiki revision ID
v2a wiki revision ID
Returns
An instance of this class populated with the retrieved data.

◆ AllowEditor()

void Reddit.Controllers.WikiPage.AllowEditor ( string  username)

Allow username to edit this wiki page.

Parameters
usernamethe name of an existing user

◆ AllowEditorAsync()

async Task Reddit.Controllers.WikiPage.AllowEditorAsync ( string  username)

Asynchronously allow username to edit this wiki page.

Parameters
usernamethe name of an existing user

◆ Create()

void Reddit.Controllers.WikiPage.Create ( string  reason,
string  content = null 
)

Create a new wiki page.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content

◆ CreateAndReturn()

WikiPage Reddit.Controllers.WikiPage.CreateAndReturn ( string  reason,
string  content = null 
)

Create a new wiki page and return an instance with the updated data.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content

◆ CreateAsync()

async Task Reddit.Controllers.WikiPage.CreateAsync ( string  reason,
string  content = null 
)

Create a new wiki page asynchronously.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content

◆ CreateMonitoringThread()

override Thread Reddit.Controllers.WikiPage.CreateMonitoringThread ( string  key,
string  subKey,
int  startDelayMs = 0,
int?  monitoringDelayMs = null 
)
protectedvirtual

Creates a new monitoring thread.

Parameters
keyMonitoring key
subKeyMonitoring subKey
startDelayMsHow long to wait before starting the thread in milliseconds (default: 0)
monitoringDelayMsHow long to wait between monitoring queries; pass null to leave it auto-managed (default: null)
Returns
The newly-created monitoring thread.

Implements Reddit.Controllers.Internal.Monitors.

◆ DenyEditor()

void Reddit.Controllers.WikiPage.DenyEditor ( string  username)

Deny username to edit this wiki page.

Parameters
usernamethe name of an existing user

◆ DenyEditorAsync()

async Task Reddit.Controllers.WikiPage.DenyEditorAsync ( string  username)

Asynchronously deny username to edit this wiki page.

Parameters
usernamethe name of an existing user

◆ Edit() [1/2]

void Reddit.Controllers.WikiPage.Edit ( string  reason,
string  content = null,
string  previous = "" 
)

Edit this wiki page.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content
previousthe starting point revision for this edit

◆ Edit() [2/2]

void Reddit.Controllers.WikiPage.Edit ( WikiEditPageInput  wikiEditPageInput)

Edit this wiki page.

Parameters
wikiEditPageInputA valid WikiEditPageInput instance

◆ EditAndReturn() [1/2]

WikiPage Reddit.Controllers.WikiPage.EditAndReturn ( string  reason,
string  content = null,
string  previous = "" 
)

Edit a wiki page and return an instance with the updated data.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content
previousthe starting point revision for this edit
Returns
The updated WikiPage.

◆ EditAndReturn() [2/2]

WikiPage Reddit.Controllers.WikiPage.EditAndReturn ( WikiEditPageInput  wikiEditPageInput)

Edit a wiki page and return an instance with the updated data.

Parameters
wikiEditPageInputA valid WikiEditPageInput instance
Returns
The updated WikiPage.

◆ EditAsync() [1/2]

async Task Reddit.Controllers.WikiPage.EditAsync ( string  reason,
string  content = null,
string  previous = "" 
)

Edit this wiki page asynchronously.

Parameters
reasona string up to 256 characters long, consisting of printable characters
contentThe page content
previousthe starting point revision for this edit

◆ EditAsync() [2/2]

async Task Reddit.Controllers.WikiPage.EditAsync ( WikiEditPageInput  wikiEditPageInput)

Edit this wiki page asynchronously.

Parameters
wikiEditPageInputA valid WikiEditPageInput instance

◆ GetPermissions()

WikiPageSettings Reddit.Controllers.WikiPage.GetPermissions ( )

Retrieve the current permission settings for page.

Returns
An object containing wiki page settings.

◆ Hide()

bool Reddit.Controllers.WikiPage.Hide ( string  revision)

Toggle the public visibility of a wiki page revision.

Parameters
revisiona wiki revision ID
Returns
A boolean indicating true if page was hidden, false if page was unhidden.

◆ HideAsync()

async Task<bool> Reddit.Controllers.WikiPage.HideAsync ( string  revision)

Toggle the public visibility of a wiki page revision asynchronously.

Parameters
revisiona wiki revision ID

◆ MonitorPage()

bool Reddit.Controllers.WikiPage.MonitorPage ( int?  monitoringDelayMs = null,
int?  monitoringBaseDelayMs = null,
List< MonitoringSchedule schedule = null,
bool?  breakOnFailure = null,
DateTime?  monitoringExpiration = null 
)

Monitor this wiki page for any changes.

Parameters
monitoringDelayMsThe number of milliseconds between each monitoring query; leave null to auto-manage
monitoringBaseDelayMsThe number of milliseconds between each monitoring query PER THREAD (default: 1500)
scheduleA list of one or more timeframes during which monitoring of this object will occur (default: 24/7)
breakOnFailureIf true, an exception will be thrown when a monitoring query fails; leave null to keep current setting (default: false)
monitoringExpirationIf set, monitoring will automatically stop after the specified DateTime is reached
Returns
Whether monitoring was successfully initiated.

◆ Revert()

void Reddit.Controllers.WikiPage.Revert ( string  revision)

Revert a wiki page to revision.

Parameters
revisiona wiki revision ID

◆ RevertAndReturn()

WikiPage Reddit.Controllers.WikiPage.RevertAndReturn ( string  revision)

Revert a wiki page to revision and return an instance with the updated data.

Parameters
revisiona wiki revision ID
Returns
The updated WikiPage.

◆ RevertAsync()

async Task Reddit.Controllers.WikiPage.RevertAsync ( string  revision)

Revert a wiki page to revision asynchronously.

Parameters
revisiona wiki revision ID

◆ Revisions() [1/2]

List<WikiPageRevision> Reddit.Controllers.WikiPage.Revisions ( int  limit = 25,
string  after = "",
string  before = "",
string  show = "all",
bool  srDetail = false,
int  count = 0 
)

Retrieve a list of revisions of this wiki page.

Parameters
limitthe maximum number of items desired (default: 25, maximum: 100)
afterfullname of a thing
beforefullname of a thing
show(optional) the string all
srDetail(optional) expand subreddits
counta positive integer (default: 0)
Returns
A list of revisions.

◆ Revisions() [2/2]

List<WikiPageRevision> Reddit.Controllers.WikiPage.Revisions ( SrListingInput  srListingInput)

Retrieve a list of revisions of this wiki page.

Parameters
srListingInputA valid SrListingInput instance
Returns
A list of revisions.

◆ SaveChanges()

void Reddit.Controllers.WikiPage.SaveChanges ( string  reason,
string  previous = "" 
)

Edit this wiki page with the current values of this instance.

Parameters
reasona string up to 256 characters long, consisting of printable characters
previousthe starting point revision for this edit

◆ SaveChangesAsync()

async Task Reddit.Controllers.WikiPage.SaveChangesAsync ( string  reason,
string  previous = "" 
)

Edit this wiki page with the current values of this instance asynchronously.

Parameters
reasona string up to 256 characters long, consisting of printable characters
previousthe starting point revision for this edit

◆ UpdatePermissions() [1/3]

WikiPageSettings Reddit.Controllers.WikiPage.UpdatePermissions ( bool  listed,
int  permLevel 
)

Update the permissions and visibility of wiki page.

Parameters
listedboolean value (true = appear in /wiki/pages, false = don't appear in /wiki/pages)
permLevelan integer (0 = use wiki perms, 1 = only approved users may edit, 2 = only mods may edit or view)
Returns
An object containing wiki page settings.

◆ UpdatePermissions() [2/3]

WikiPageSettings Reddit.Controllers.WikiPage.UpdatePermissions ( WikiPageSettings  wikiPageSettings)

Update the permissions and visibility of wiki page.

Parameters
wikiPageSettingsA valid instance of WikiPageSettings
Returns
An object containing wiki page settings.

◆ UpdatePermissions() [3/3]

WikiPageSettings Reddit.Controllers.WikiPage.UpdatePermissions ( WikiUpdatePermissionsInput  wikiUpdatePermissionsInput)

Update the permissions and visibility of wiki page.

Parameters
wikiUpdatePermissionsInputA valid WikiUpdatePermissionsInput instance
Returns
An object containing wiki page settings.

◆ UpdatePermissionsAsync() [1/3]

async Task<WikiPageSettings> Reddit.Controllers.WikiPage.UpdatePermissionsAsync ( bool  listed,
int  permLevel 
)

Update the permissions and visibility of wiki page asynchronously.

Parameters
listedboolean value (true = appear in /wiki/pages, false = don't appear in /wiki/pages)
permLevelan integer (0 = use wiki perms, 1 = only approved users may edit, 2 = only mods may edit or view)

◆ UpdatePermissionsAsync() [2/3]

async Task<WikiPageSettings> Reddit.Controllers.WikiPage.UpdatePermissionsAsync ( WikiPageSettings  wikiPageSettings)

Update the permissions and visibility of wiki page asynchronously.

Parameters
wikiPageSettingsA valid instance of WikiPageSettings

◆ UpdatePermissionsAsync() [3/3]

async Task<WikiPageSettings> Reddit.Controllers.WikiPage.UpdatePermissionsAsync ( WikiUpdatePermissionsInput  wikiUpdatePermissionsInput)

Update the permissions and visibility of wiki page asynchronously.

Parameters
wikiUpdatePermissionsInputA valid WikiUpdatePermissionsInput instance

◆ WikiPagesIsMonitored()

bool Reddit.Controllers.WikiPage.WikiPagesIsMonitored ( )

Whether updates to this wiki page are being monitored.

Returns
Whether updates to this wiki page are being monitored.

Property Documentation

◆ ContentHTML

string Reddit.Controllers.WikiPage.ContentHTML
getset

The page content rendered as HTML.

◆ ContentMd

string Reddit.Controllers.WikiPage.ContentMd
getset

The page content.

◆ MayRevise

bool Reddit.Controllers.WikiPage.MayRevise
getset

Whether the authenticated user can edit this page.

◆ Name

string Reddit.Controllers.WikiPage.Name
getset

The page name.

◆ RevisionBy

User Reddit.Controllers.WikiPage.RevisionBy
getset

The user who authored the current revision.

◆ RevisionDate

DateTime Reddit.Controllers.WikiPage.RevisionDate
getset

The current revision date.

◆ Subreddit

string Reddit.Controllers.WikiPage.Subreddit
getset

The name of the subreddit this wiki belongs to.

Event Documentation

◆ PageUpdated

EventHandler<WikiPageUpdateEventArgs> Reddit.Controllers.WikiPage.PageUpdated

Event handler for monitoring update to this wiki page.


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