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

The main Reddit API class. More...

Inheritance diagram for Reddit.RedditClient:
Reddit.RedditAPI

Public Member Functions

 RedditClient (string appId=null, string refreshToken=null, string appSecret=null, string accessToken=null, string userAgent=null)
 Create a new instance of the Reddit.NET API library. This instance will be bound to a single Reddit user. More...
 
List< PostGetFrontPage (string after="", string before="", int limit=100)
 
void WaitForRequestQueue (int waitUntilRequestsAt=0)
 Wait until the requests queue is either empty or down to the specified number of remaining requests. More...
 
Comment Comment (string name)
 Create a new comment controller instance, populated only with its fullname. More...
 
LinkPost LinkPost (string name)
 Create a new link post controller instance, populated only with its fullname. More...
 
SelfPost SelfPost (string name)
 Create a new self post controller instance, populated only with its fullname. More...
 
Post Post (string name)
 Create a new post controller instance, populated only with its fullname. More...
 
LiveThread LiveThread (Things.LiveUpdateEvent liveUpdateEvent)
 Create a new live thread controller instance from API return data. More...
 
LiveThread LiveThread (LiveThread liveThread)
 Create a copy of an existing live thread controller instance. More...
 
LiveThread LiveThread (string title=null, string description=null, bool nsfw=false, string resources=null, string id=null, string name=null, string websocketUrl=null, string announcementUrl=null, string state=null, string icon=null, int? totalViews=null, int viewerCount=0, DateTime created=default(DateTime))
 Create a new live thread controller instance, populated manually. More...
 
LiveThread LiveThread (string id)
 Create a new live thread controller instance, populated only with its ID. More...
 
User User (Things.User user)
 Create a new user controller instance from API return data. More...
 
User User (User user)
 Create a copy of an existing user controller instance. More...
 
User User (string name, string id=null, bool isFriend=false, bool profanityFilter=false, bool isSuspended=false, bool hasGoldSubscription=false, int numFriends=0, bool IsVerified=false, bool hasNewModmail=false, bool over18=false, bool isGold=false, bool isMod=false, bool hasVerifiedEmail=false, string iconImg=null, bool hasModmail=false, int linkKarma=0, int inboxCount=0, bool hasMail=false, DateTime created=default(DateTime), int commentKarma=0, bool hasSubscribed=false)
 Create a new user controller instance, populated manually. More...
 
User User ()
 Create an empty user controller instance. More...
 
Subreddit Subreddit (Subreddit subreddit)
 Create a copy of an existing subreddit controller instance. More...
 
Subreddit Subreddit (Things.Subreddit subreddit)
 Create a new subreddit instance from API return data. More...
 
Subreddit Subreddit (Things.SubredditChild subredditChild)
 Create a new subreddit instance from API return data. More...
 
Subreddit Subreddit (string name, string title="", string description="", string sidebar="", string submissionText=null, string lang="en", string subredditType="public", string submissionType="any", string submitLinkLabel=null, string submitTextLabel=null, bool wikiEnabled=false, bool over18=false, bool allowDiscovery=true, bool allowSpoilers=true, bool showMedia=true, bool showMediaPreview=true, bool allowImages=true, bool allowVideos=true, bool collapseDeletedComments=false, string suggestedCommentSort=null, int commentScoreHideMins=0, byte[] headerImage=null, byte[] iconImage=null, string primaryColor=null, string keyColor=null, string fullname=null)
 Create a new subreddit controller instance, populated manually. More...
 
Subreddit Subreddit ()
 Create an empty subreddit controller instance. More...
 
List< PostGetPosts (List< string > fullnames)
 Get a listing of posts by fullname. More...
 
List< PostGetPosts (List< Post > posts)
 Get a listing of posts by fullname. More...
 
Dictionary< string, Things.Scope > Scopes (string scopes=null)
 Retrieve descriptions of reddit's OAuth2 scopes. If no scopes are given, information on all scopes are returned. Invalid scope(s) will result in a 400 error with body that indicates the invalid scope(s). More...
 
List< string > SearchRedditNames (string query, bool exact=false, bool includeOver18=true, bool includeUnadvertisable=true)
 List subreddit names that begin with a query string. Subreddits whose names begin with query will be returned. If include_over_18 is false, subreddits with over-18 content restrictions will be filtered from the results. If include_unadvertisable is False, subreddits that have hide_ads set to True or are on the anti_ads_subreddits list will be filtered. If exact is true, only an exact match will be returned. Exact matches are inclusive of over_18 subreddits, but not hide_ad subreddits when include_unadvertisable is False. More...
 
List< Things.SubSearchResult > SearchSubredditNames (string query, bool exact=false, bool includeOver18=true, bool includeUnadvertisable=true)
 List subreddits that begin with a query string. Subreddits whose names begin with query will be returned. If include_over_18 is false, subreddits with over-18 content restrictions will be filtered from the results. If include_unadvertisable is False, subreddits that have hide_ads set to True or are on the anti_ads_subreddits list will be filtered. If exact is true, only an exact match will be returned.Exact matches are inclusive of over_18 subreddits, but not hide_ad subreddits when include_unadvertisable is False. More...
 
List< SubredditSearchSubreddits (string query, int limit=25, bool showUsers=false, string after="", string before="", string sort="relevance", string show="all", bool srDetail=false, int count=0)
 Search subreddits by title and description. More...
 
List< Things.SubredditAutocompleteResult > SubredditAutocomplete (string query, bool includeOver18=true, bool includeProfiles=true)
 Return a list of subreddits and data for subreddits whose names start with 'query'. Uses typeahead endpoint to recieve the list of subreddits names. Typeahead provides exact matches, typo correction, fuzzy matching and boosts subreddits to the top that the user is subscribed to. More...
 
List< SubredditSubredditAutocompleteV2 (string query, bool includeOver18=true, bool includeProfiles=true, bool includeCategories=true, int limit=5)
 Version 2 of SubredditAutocomplete. More...
 
List< SubredditSearchSubreddits (SearchGetSearchInput searchGetSearchInput)
 Search Reddit for matching users. More...
 
List< UserSearchUsers (SearchGetSearchInput searchGetSearchInput)
 Search Reddit for matching users. More...
 
Things.MixedListingContainer MixedSearch (SearchGetSearchInput searchGetSearchInput)
 Search Reddit for matching things. This method can return links, subreddits, and/or users. To include all of them, set type to "link,sr,user". More...
 
List< PostSearch (SearchGetSearchInput searchGetSearchInput)
 Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller. More...
 
List< PostSearch (string q, SearchGetSearchInput searchGetSearchInput=null)
 Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller. More...
 
List< PostSearch (string q="", string sort="new", string category="", bool includeFacets=false, string type=null, string t="all", string after=null, string before=null, bool includeCategories=false, int count=0, int limit=25, string show="all", bool srDetail=false)
 Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller. More...
 
List< SubredditGetSubreddits (string where, int limit=25, string after="", string before="", bool includeCategories=false, string show="all", bool srDetail=false, int count=0)
 Get all subreddits. The where parameter chooses the order in which the subreddits are displayed. popular sorts on the activity of the subreddit and the position of the subreddits can shift around. new sorts the subreddits based on their creation date, newest first. More...
 
List< SubredditGetUserSubreddits (string where, int limit=25, string after="", string before="", bool includeCategories=false, string show="all", bool srDetail=false, int count=0)
 Get all subreddits. The where parameter chooses the order in which the subreddits are displayed. popular sorts on the activity of the subreddit and the position of the subreddits can shift around. new sorts the subreddits based on their creation date, newest first. More...
 
List< UserUserDataByAccountIds (List< string > fullnames)
 Get user data by account IDs. More...
 
List< UserUserDataByAccountIds (List< User > users)
 Get user data by account IDs. More...
 

Public Attributes

Dispatch Models
 Endpoint wrapper classes/methods. More...
 

Properties

Account?? Account [get]
 Data/methods pertaining to the authenticated user. More...
 
List< Post >? FrontPage [get]
 List of posts on the front page. More...
 

Detailed Description

The main Reddit API class.

Constructor & Destructor Documentation

◆ RedditClient()

Reddit.RedditClient.RedditClient ( string  appId = null,
string  refreshToken = null,
string  appSecret = null,
string  accessToken = null,
string  userAgent = null 
)

Create a new instance of the Reddit.NET API library. This instance will be bound to a single Reddit user.

Parameters
appIdThe OAuth application ID
refreshTokenThe OAuth refresh token for the user we wish to authenticate
appSecretThe OAuth application secret; this parameter is required for 'script' apps which use a secret to authenticate
accessToken(optional) An OAuth access token; if not provided, one will be automatically obtained using the refresh token
userAgent(optional) A custom string for the User-Agent header

Member Function Documentation

◆ Comment()

Comment Reddit.RedditClient.Comment ( string  name)

Create a new comment controller instance, populated only with its fullname.

Parameters
namefullname of a thing
Returns
A new comment controller instance.

◆ GetFrontPage()

List<Post> Reddit.RedditClient.GetFrontPage ( string  after = "",
string  before = "",
int  limit = 100 
)

◆ GetPosts() [1/2]

List<Post> Reddit.RedditClient.GetPosts ( List< Post posts)

Get a listing of posts by fullname.

Parameters
postsA list of post objects with valid Fullnames
Returns
A list of populated posts.

◆ GetPosts() [2/2]

List<Post> Reddit.RedditClient.GetPosts ( List< string >  fullnames)

Get a listing of posts by fullname.

Parameters
fullnamesA list of post fullnames
Returns
A list of populated posts.

◆ GetSubreddits()

List<Subreddit> Reddit.RedditClient.GetSubreddits ( string  where,
int  limit = 25,
string  after = "",
string  before = "",
bool  includeCategories = false,
string  show = "all",
bool  srDetail = false,
int  count = 0 
)

Get all subreddits. The where parameter chooses the order in which the subreddits are displayed. popular sorts on the activity of the subreddit and the position of the subreddits can shift around. new sorts the subreddits based on their creation date, newest first.

Parameters
whereOne of (popular, new, gold, default)
limitthe maximum number of items desired (default: 25, maximum: 100)
afterfullname of a thing
beforefullname of a thing
includeCategoriesboolean value
show(optional) the string all
srDetail(optional) expand subreddits
counta positive integer (default: 0)
Returns
List of subreddit objects.

◆ GetUserSubreddits()

List<Subreddit> Reddit.RedditClient.GetUserSubreddits ( string  where,
int  limit = 25,
string  after = "",
string  before = "",
bool  includeCategories = false,
string  show = "all",
bool  srDetail = false,
int  count = 0 
)

Get all subreddits. The where parameter chooses the order in which the subreddits are displayed. popular sorts on the activity of the subreddit and the position of the subreddits can shift around. new sorts the subreddits based on their creation date, newest first.

Parameters
whereOne of (popular, new, gold, default)
limitthe maximum number of items desired (default: 25, maximum: 100)
afterfullname of a thing
beforefullname of a thing
includeCategoriesboolean value
show(optional) the string all
srDetail(optional) expand subreddits
counta positive integer (default: 0)
Returns
List of subreddit objects.

◆ LinkPost()

LinkPost Reddit.RedditClient.LinkPost ( string  name)

Create a new link post controller instance, populated only with its fullname.

Parameters
namefullname of a thing
Returns
A new link post controller instance.

◆ LiveThread() [1/4]

LiveThread Reddit.RedditClient.LiveThread ( LiveThread  liveThread)

Create a copy of an existing live thread controller instance.

Parameters
liveThreadA valid live thread controller instance
Returns
A new live thread controller instance.

◆ LiveThread() [2/4]

LiveThread Reddit.RedditClient.LiveThread ( string  id)

Create a new live thread controller instance, populated only with its ID.

Parameters
idA valid live thread ID
Returns
A new live thread controller instance.

◆ LiveThread() [3/4]

LiveThread Reddit.RedditClient.LiveThread ( string  title = null,
string  description = null,
bool  nsfw = false,
string  resources = null,
string  id = null,
string  name = null,
string  websocketUrl = null,
string  announcementUrl = null,
string  state = null,
string  icon = null,
int?  totalViews = null,
int  viewerCount = 0,
DateTime  created = default(DateTime) 
)

Create a new live thread controller instance, populated manually.

Parameters
titleTitle of the live thread
descriptionDescription of the live thread
nsfwWhether the live thread is NSFW
resources
id
name
websocketUrl
announcementUrl
state
icon
totalViews
viewerCount
created
Returns
A new live thread controller instance.

◆ LiveThread() [4/4]

LiveThread Reddit.RedditClient.LiveThread ( Things.LiveUpdateEvent  liveUpdateEvent)

Create a new live thread controller instance from API return data.

Parameters
liveUpdateEvent
Returns
A new live thread controller instance.

◆ MixedSearch()

Things.MixedListingContainer Reddit.RedditClient.MixedSearch ( SearchGetSearchInput  searchGetSearchInput)

Search Reddit for matching things. This method can return links, subreddits, and/or users. To include all of them, set type to "link,sr,user".

Parameters
searchGetSearchInputA valid SearchGetSearchInput instance
Returns
A list of things that match the search criteria.

◆ Post()

Post Reddit.RedditClient.Post ( string  name)

Create a new post controller instance, populated only with its fullname.

Parameters
namefullname of a thing
Returns
A new post controller instance.

◆ Scopes()

Dictionary<string, Things.Scope> Reddit.RedditClient.Scopes ( string  scopes = null)

Retrieve descriptions of reddit's OAuth2 scopes. If no scopes are given, information on all scopes are returned. Invalid scope(s) will result in a 400 error with body that indicates the invalid scope(s).

Parameters
scopes(optional) An OAuth2 scope string
Returns
A list of scopes.

◆ Search() [1/3]

List<Post> Reddit.RedditClient.Search ( SearchGetSearchInput  searchGetSearchInput)

Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller.

Parameters
searchGetSearchInputA valid SearchGetSearchInput instance
Returns
A list of posts that match the search criteria.

◆ Search() [2/3]

List<Post> Reddit.RedditClient.Search ( string  q,
SearchGetSearchInput  searchGetSearchInput = null 
)

Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller.

Parameters
qA valid search query
searchGetSearchInputA valid SearchGetSearchInput instance (optional)
Returns
A list of posts that match the search criteria.

◆ Search() [3/3]

List<Post> Reddit.RedditClient.Search ( string  q = "",
string  sort = "new",
string  category = "",
bool  includeFacets = false,
string  type = null,
string  t = "all",
string  after = null,
string  before = null,
bool  includeCategories = false,
int  count = 0,
int  limit = 25,
string  show = "all",
bool  srDetail = false 
)

Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller.

Parameters
qa string no longer than 512 characters
restrictSrboolean value
sortone of (relevance, hot, top, new, comments)
categorya string no longer than 5 characters
includeFacetsboolean value
type(optional) comma-delimited list of result types (sr, link, user)
tone of (hour, day, week, month, year, all)
afterfullname of a thing
beforefullname of a thing
includeCategoriesboolean value
counta positive integer (default: 0)
limitthe maximum number of items desired (default: 25, maximum: 100)
show(optional) the string all
srDetailboolean value
Returns
A list of posts that match the search criteria.

◆ SearchRedditNames()

List<string> Reddit.RedditClient.SearchRedditNames ( string  query,
bool  exact = false,
bool  includeOver18 = true,
bool  includeUnadvertisable = true 
)

List subreddit names that begin with a query string. Subreddits whose names begin with query will be returned. If include_over_18 is false, subreddits with over-18 content restrictions will be filtered from the results. If include_unadvertisable is False, subreddits that have hide_ads set to True or are on the anti_ads_subreddits list will be filtered. If exact is true, only an exact match will be returned. Exact matches are inclusive of over_18 subreddits, but not hide_ad subreddits when include_unadvertisable is False.

Parameters
querya string up to 50 characters long, consisting of printable characters
exactboolean value
includeOver18boolean value
includeUnadvertisableboolean value
Returns
A list of subreddit names.

◆ SearchSubredditNames()

List<Things.SubSearchResult> Reddit.RedditClient.SearchSubredditNames ( string  query,
bool  exact = false,
bool  includeOver18 = true,
bool  includeUnadvertisable = true 
)

List subreddits that begin with a query string. Subreddits whose names begin with query will be returned. If include_over_18 is false, subreddits with over-18 content restrictions will be filtered from the results. If include_unadvertisable is False, subreddits that have hide_ads set to True or are on the anti_ads_subreddits list will be filtered. If exact is true, only an exact match will be returned.Exact matches are inclusive of over_18 subreddits, but not hide_ad subreddits when include_unadvertisable is False.

Parameters
querya string up to 50 characters long, consisting of printable characters
exactboolean value
includeOver18boolean value
includeUnadvertisableboolean value
Returns
A list of subreddit listings.

◆ SearchSubreddits() [1/2]

List<Subreddit> Reddit.RedditClient.SearchSubreddits ( SearchGetSearchInput  searchGetSearchInput)

Search Reddit for matching users.

Parameters
searchGetSearchInputA valid SearchGetSearchInput instance
Returns
A list of users that match the search criteria.

◆ SearchSubreddits() [2/2]

List<Subreddit> Reddit.RedditClient.SearchSubreddits ( string  query,
int  limit = 25,
bool  showUsers = false,
string  after = "",
string  before = "",
string  sort = "relevance",
string  show = "all",
bool  srDetail = false,
int  count = 0 
)

Search subreddits by title and description.

Parameters
querya search query
limitthe maximum number of items desired (default: 25, maximum: 100)
showUsersboolean value
afterfullname of a thing
beforefullname of a thing
sortone of (relevance, activity)
show(optional) the string all
srDetail(optional) expand subreddits
counta positive integer (default: 0)
Returns
A list of subreddit objects.

◆ SearchUsers()

List<User> Reddit.RedditClient.SearchUsers ( SearchGetSearchInput  searchGetSearchInput)

Search Reddit for matching users.

Parameters
searchGetSearchInputA valid SearchGetSearchInput instance
Returns
A list of users that match the search criteria.

◆ SelfPost()

SelfPost Reddit.RedditClient.SelfPost ( string  name)

Create a new self post controller instance, populated only with its fullname.

Parameters
namefullname of a thing
Returns
A new self post controller instance.

◆ Subreddit() [1/5]

Subreddit Reddit.RedditClient.Subreddit ( )

Create an empty subreddit controller instance.

Returns
A new subreddit controller instance.

◆ Subreddit() [2/5]

Subreddit Reddit.RedditClient.Subreddit ( string  name,
string  title = "",
string  description = "",
string  sidebar = "",
string  submissionText = null,
string  lang = "en",
string  subredditType = "public",
string  submissionType = "any",
string  submitLinkLabel = null,
string  submitTextLabel = null,
bool  wikiEnabled = false,
bool  over18 = false,
bool  allowDiscovery = true,
bool  allowSpoilers = true,
bool  showMedia = true,
bool  showMediaPreview = true,
bool  allowImages = true,
bool  allowVideos = true,
bool  collapseDeletedComments = false,
string  suggestedCommentSort = null,
int  commentScoreHideMins = 0,
byte[]  headerImage = null,
byte[]  iconImage = null,
string  primaryColor = null,
string  keyColor = null,
string  fullname = null 
)

Create a new subreddit controller instance, populated manually.

Parameters
name
title
description
sidebar
submissionText
lang
subredditType
submissionType
submitLinkLabel
submitTextLabel
wikiEnabled
over18
allowDiscovery
allowSpoilers
showMedia
showMediaPreview
allowImages
allowVideos
collapseDeletedComments
suggestedCommentSort
commentScoreHideMins
headerImage
iconImage
primaryColor
keyColor
fullname
Returns
A new subreddit controller instance.

◆ Subreddit() [3/5]

Subreddit Reddit.RedditClient.Subreddit ( Subreddit  subreddit)

Create a copy of an existing subreddit controller instance.

Parameters
subredditA valid subreddit controller instance
Returns
A new subreddit controller instance.

◆ Subreddit() [4/5]

Subreddit Reddit.RedditClient.Subreddit ( Things.Subreddit  subreddit)

Create a new subreddit instance from API return data.

Parameters
subreddit
Returns
A new subreddit controller instance.

◆ Subreddit() [5/5]

Subreddit Reddit.RedditClient.Subreddit ( Things.SubredditChild  subredditChild)

Create a new subreddit instance from API return data.

Parameters
subredditChild
Returns
A new subreddit controller instance.

◆ SubredditAutocomplete()

List<Things.SubredditAutocompleteResult> Reddit.RedditClient.SubredditAutocomplete ( string  query,
bool  includeOver18 = true,
bool  includeProfiles = true 
)

Return a list of subreddits and data for subreddits whose names start with 'query'. Uses typeahead endpoint to recieve the list of subreddits names. Typeahead provides exact matches, typo correction, fuzzy matching and boosts subreddits to the top that the user is subscribed to.

Parameters
querya string up to 50 characters long, consisting of printable characters
includeOver18boolean value
includeProfilesboolean value
Returns
Matching subreddits.

◆ SubredditAutocompleteV2()

List<Subreddit> Reddit.RedditClient.SubredditAutocompleteV2 ( string  query,
bool  includeOver18 = true,
bool  includeProfiles = true,
bool  includeCategories = true,
int  limit = 5 
)

Version 2 of SubredditAutocomplete.

Parameters
querya string up to 50 characters long, consisting of printable characters

<param name="includeOver18"boolean value>

Parameters
includeProfilesboolean value
includeCategoriesboolean value
limitan integer between 1 and 10 (default: 5)
Returns
Matching subreddits.

◆ User() [1/4]

User Reddit.RedditClient.User ( )

Create an empty user controller instance.

Returns
A new user controller instance.

◆ User() [2/4]

User Reddit.RedditClient.User ( string  name,
string  id = null,
bool  isFriend = false,
bool  profanityFilter = false,
bool  isSuspended = false,
bool  hasGoldSubscription = false,
int  numFriends = 0,
bool  IsVerified = false,
bool  hasNewModmail = false,
bool  over18 = false,
bool  isGold = false,
bool  isMod = false,
bool  hasVerifiedEmail = false,
string  iconImg = null,
bool  hasModmail = false,
int  linkKarma = 0,
int  inboxCount = 0,
bool  hasMail = false,
DateTime  created = default(DateTime),
int  commentKarma = 0,
bool  hasSubscribed = false 
)

Create a new user controller instance, populated manually.

Parameters
nameA valid Reddit username
id
isFriend
profanityFilter
isSuspended
hasGoldSubscription
numFriends
IsVerified
hasNewModmail
over18
isGold
isMod
hasVerifiedEmail
iconImg
hasModmail
linkKarma
inboxCount
hasMail
created
commentKarma
hasSubscribed
Returns
A new user controller instance.

◆ User() [3/4]

User Reddit.RedditClient.User ( Things.User  user)

Create a new user controller instance from API return data.

Parameters
user
Returns
A new user controller instance.

◆ User() [4/4]

User Reddit.RedditClient.User ( User  user)

Create a copy of an existing user controller instance.

Parameters
userA valid user controller instance.
Returns
A new user controller instance.

◆ UserDataByAccountIds() [1/2]

List<User> Reddit.RedditClient.UserDataByAccountIds ( List< string >  fullnames)

Get user data by account IDs.

Parameters
fullnamesA list of account fullnames
Returns
A dictionary of user summary objects.

◆ UserDataByAccountIds() [2/2]

List<User> Reddit.RedditClient.UserDataByAccountIds ( List< User users)

Get user data by account IDs.

Parameters
usersA list of user objects with valid Fullnames
Returns
A dictionary of user summary objects.

◆ WaitForRequestQueue()

void Reddit.RedditClient.WaitForRequestQueue ( int  waitUntilRequestsAt = 0)

Wait until the requests queue is either empty or down to the specified number of remaining requests.

Parameters
waitUntilRequestsAtThe wait ends when the number of requests count goes down to less than or equal to this value

Member Data Documentation

◆ Models

Dispatch Reddit.RedditClient.Models

Endpoint wrapper classes/methods.

Property Documentation

◆ Account

Account?? Reddit.RedditClient.Account
get

Data/methods pertaining to the authenticated user.

◆ FrontPage

List<Post>? Reddit.RedditClient.FrontPage
get

List of posts on the front page.


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