![]() |
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.
|
The main Reddit API class. More...
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< Post > | GetFrontPage (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< Post > | GetPosts (List< string > fullnames) |
Get a listing of posts by fullname. More... | |
List< Post > | GetPosts (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< Subreddit > | 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. 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< Subreddit > | SubredditAutocompleteV2 (string query, bool includeOver18=true, bool includeProfiles=true, bool includeCategories=true, int limit=5) |
Version 2 of SubredditAutocomplete. More... | |
List< Subreddit > | SearchSubreddits (SearchGetSearchInput searchGetSearchInput) |
Search Reddit for matching users. More... | |
List< User > | SearchUsers (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< Post > | Search (SearchGetSearchInput searchGetSearchInput) |
Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller. More... | |
List< Post > | Search (string q, SearchGetSearchInput searchGetSearchInput=null) |
Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller. More... | |
List< Post > | 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. More... | |
List< Subreddit > | 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. More... | |
List< Subreddit > | 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. More... | |
List< User > | UserDataByAccountIds (List< string > fullnames) |
Get user data by account IDs. More... | |
List< User > | UserDataByAccountIds (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... | |
The main Reddit API class.
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.
appId | The OAuth application ID |
refreshToken | The OAuth refresh token for the user we wish to authenticate |
appSecret | The 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 |
Comment Reddit.RedditClient.Comment | ( | string | name | ) |
Create a new comment controller instance, populated only with its fullname.
name | fullname of a thing |
List<Post> Reddit.RedditClient.GetFrontPage | ( | string | after = "" , |
string | before = "" , |
||
int | limit = 100 |
||
) |
Get a listing of posts by fullname.
posts | A list of post objects with valid Fullnames |
List<Post> Reddit.RedditClient.GetPosts | ( | List< string > | fullnames | ) |
Get a listing of posts by fullname.
fullnames | A list of post fullnames |
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.
where | One of (popular, new, gold, default) |
limit | the maximum number of items desired (default: 25, maximum: 100) |
after | fullname of a thing |
before | fullname of a thing |
includeCategories | boolean value |
show | (optional) the string all |
srDetail | (optional) expand subreddits |
count | a positive integer (default: 0) |
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.
where | One of (popular, new, gold, default) |
limit | the maximum number of items desired (default: 25, maximum: 100) |
after | fullname of a thing |
before | fullname of a thing |
includeCategories | boolean value |
show | (optional) the string all |
srDetail | (optional) expand subreddits |
count | a positive integer (default: 0) |
LinkPost Reddit.RedditClient.LinkPost | ( | string | name | ) |
Create a new link post controller instance, populated only with its fullname.
name | fullname of a thing |
LiveThread Reddit.RedditClient.LiveThread | ( | LiveThread | liveThread | ) |
Create a copy of an existing live thread controller instance.
liveThread | A valid live thread controller instance |
LiveThread Reddit.RedditClient.LiveThread | ( | string | id | ) |
Create a new live thread controller instance, populated only with its ID.
id | A valid live thread ID |
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.
title | Title of the live thread |
description | Description of the live thread |
nsfw | Whether the live thread is NSFW |
resources | |
id | |
name | |
websocketUrl | |
announcementUrl | |
state | |
icon | |
totalViews | |
viewerCount | |
created |
LiveThread Reddit.RedditClient.LiveThread | ( | Things.LiveUpdateEvent | liveUpdateEvent | ) |
Create a new live thread controller instance from API return data.
liveUpdateEvent |
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".
searchGetSearchInput | A valid SearchGetSearchInput instance |
Post Reddit.RedditClient.Post | ( | string | name | ) |
Create a new post controller instance, populated only with its fullname.
name | fullname of a thing |
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).
scopes | (optional) An OAuth2 scope string |
List<Post> Reddit.RedditClient.Search | ( | SearchGetSearchInput | searchGetSearchInput | ) |
Search all subreddits for posts. To search a specific subreddit for posts, use the Subreddit controller.
searchGetSearchInput | A valid SearchGetSearchInput instance |
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.
q | A valid search query |
searchGetSearchInput | A valid SearchGetSearchInput instance (optional) |
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.
q | a string no longer than 512 characters |
restrictSr | boolean value |
sort | one of (relevance, hot, top, new, comments) |
category | a string no longer than 5 characters |
includeFacets | boolean value |
type | (optional) comma-delimited list of result types (sr, link, user) |
t | one of (hour, day, week, month, year, all) |
after | fullname of a thing |
before | fullname of a thing |
includeCategories | boolean value |
count | a positive integer (default: 0) |
limit | the maximum number of items desired (default: 25, maximum: 100) |
show | (optional) the string all |
srDetail | boolean value |
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.
query | a string up to 50 characters long, consisting of printable characters |
exact | boolean value |
includeOver18 | boolean value |
includeUnadvertisable | boolean value |
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.
query | a string up to 50 characters long, consisting of printable characters |
exact | boolean value |
includeOver18 | boolean value |
includeUnadvertisable | boolean value |
List<Subreddit> Reddit.RedditClient.SearchSubreddits | ( | SearchGetSearchInput | searchGetSearchInput | ) |
Search Reddit for matching users.
searchGetSearchInput | A valid SearchGetSearchInput instance |
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.
query | a search query |
limit | the maximum number of items desired (default: 25, maximum: 100) |
showUsers | boolean value |
after | fullname of a thing |
before | fullname of a thing |
sort | one of (relevance, activity) |
show | (optional) the string all |
srDetail | (optional) expand subreddits |
count | a positive integer (default: 0) |
List<User> Reddit.RedditClient.SearchUsers | ( | SearchGetSearchInput | searchGetSearchInput | ) |
Search Reddit for matching users.
searchGetSearchInput | A valid SearchGetSearchInput instance |
SelfPost Reddit.RedditClient.SelfPost | ( | string | name | ) |
Create a new self post controller instance, populated only with its fullname.
name | fullname of a thing |
Subreddit Reddit.RedditClient.Subreddit | ( | ) |
Create an empty subreddit controller instance.
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.
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 |
Create a copy of an existing subreddit controller instance.
subreddit | A valid subreddit controller instance |
Subreddit Reddit.RedditClient.Subreddit | ( | Things.Subreddit | subreddit | ) |
Create a new subreddit instance from API return data.
subreddit |
Subreddit Reddit.RedditClient.Subreddit | ( | Things.SubredditChild | subredditChild | ) |
Create a new subreddit instance from API return data.
subredditChild |
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.
query | a string up to 50 characters long, consisting of printable characters |
includeOver18 | boolean value |
includeProfiles | boolean value |
List<Subreddit> Reddit.RedditClient.SubredditAutocompleteV2 | ( | string | query, |
bool | includeOver18 = true , |
||
bool | includeProfiles = true , |
||
bool | includeCategories = true , |
||
int | limit = 5 |
||
) |
Version 2 of SubredditAutocomplete.
query | a string up to 50 characters long, consisting of printable characters |
<param name="includeOver18"boolean value>
includeProfiles | boolean value |
includeCategories | boolean value |
limit | an integer between 1 and 10 (default: 5) |
User Reddit.RedditClient.User | ( | ) |
Create an empty user controller instance.
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.
name | A valid Reddit username |
id | |
isFriend | |
profanityFilter | |
isSuspended | |
hasGoldSubscription | |
numFriends | |
IsVerified | |
hasNewModmail | |
over18 | |
isGold | |
isMod | |
hasVerifiedEmail | |
iconImg | |
hasModmail | |
linkKarma | |
inboxCount | |
hasMail | |
created | |
commentKarma | |
hasSubscribed |
User Reddit.RedditClient.User | ( | Things.User | user | ) |
Create a new user controller instance from API return data.
user |
Create a copy of an existing user controller instance.
user | A valid user controller instance. |
List<User> Reddit.RedditClient.UserDataByAccountIds | ( | List< string > | fullnames | ) |
Get user data by account IDs.
fullnames | A list of account fullnames |
Get user data by account IDs.
users | A list of user objects with valid Fullnames |
void Reddit.RedditClient.WaitForRequestQueue | ( | int | waitUntilRequestsAt = 0 | ) |
Wait until the requests queue is either empty or down to the specified number of remaining requests.
waitUntilRequestsAt | The wait ends when the number of requests count goes down to less than or equal to this value |
Dispatch Reddit.RedditClient.Models |
Endpoint wrapper classes/methods.
|
get |
Data/methods pertaining to the authenticated user.
|
get |
List of posts on the front page.