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.Models.Users Class Reference
Inheritance diagram for Reddit.Models.Users:
Reddit.Models.BaseModel Reddit.Models.Internal.Request

Public Member Functions

 Users (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
UserActionResult BlockUser (UsersBlockUserInput usersBlockUserInput)
 For blocking a user. More...
 
async Task< UserActionResultBlockUserAsync (UsersBlockUserInput usersBlockUserInput)
 For blocking a user asynchronously. More...
 
GenericContainer Friend (UsersFriendInput usersFriendInput, string subreddit=null)
 Create a relationship between a user and another user or subreddit. OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: Use "moderator_invite" moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_unfriend More...
 
async Task< GenericContainerFriendAsync (UsersFriendInput usersFriendInput, string subreddit=null)
 Create a relationship between a user and another user or subreddit asynchronously. OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: Use "moderator_invite" moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_unfriend More...
 
void ReportUser (UsersReportUserInput usersReportUserInput)
 Report a user. Reporting a user brings it to the attention of a Reddit admin. More...
 
async Task ReportUserAsync (UsersReportUserInput usersReportUserInput)
 Report a user asynchronously. Reporting a user brings it to the attention of a Reddit admin. More...
 
GenericContainer SetPermissions (UsersSetPermissionsInput usersSetPermissionsInput, string subreddit=null)
 Set permissions. More...
 
async Task< GenericContainerSetPermissionsAsync (UsersSetPermissionsInput usersSetPermissionsInput, string subreddit=null)
 Set permissions asynchronously. More...
 
void Unfriend (UsersUnfriendInput usersUnfriendInput, string subreddit=null)
 Remove a relationship between a user and another user or subreddit. The user can either be passed in by name (nuser) or by fullname (iuser). If type is friend or enemy, 'container' MUST be the current user's fullname; for other types, the subreddit must be set via URL (e.g., /r/funny/api/unfriend). OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: modothers moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_friend More...
 
async Task UnfriendAsync (UsersUnfriendInput usersUnfriendInput, string subreddit=null)
 Remove a relationship between a user and another user or subreddit asynchronously. The user can either be passed in by name (nuser) or by fullname (iuser). If type is friend or enemy, 'container' MUST be the current user's fullname; for other types, the subreddit must be set via URL (e.g., /r/funny/api/unfriend). OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: modothers moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_friend More...
 
Dictionary< string, UserSummaryUserDataByAccountIds (string ids)
 Get user data by account IDs. More...
 
bool? UsernameAvailable (string user)
 Check whether a username is available for registration. More...
 
void DeleteFriend (string username)
 Stop being friends with a user. More...
 
async Task DeleteFriendAsync (string username)
 Stop being friends with a user asynchronously. More...
 
UserActionResult GetFriend (string username)
 Get information about a specific 'friend', such as notes. More...
 
UserActionResult UpdateFriend (string username, string json="{}")
 Create or update a "friend" relationship. This operation is idempotent. It can be used to add a new friend, or update an existing friend (e.g., add/change the note on that friend). More...
 
async Task< UserActionResultUpdateFriendAsync (string username, string json="{}")
 Create or update a "friend" relationship asynchronously. This operation is idempotent. It can be used to add a new friend, or update an existing friend (e.g., add/change the note on that friend). More...
 
TrophyList Trophies (string username)
 Return a list of trophies for the given user. More...
 
UserChild About (string username)
 Return information about the user, including karma and gold status. More...
 
GetUser< T > (string username, string where, UsersHistoryInput usersHistoryInput)
 This endpoint is a listing. More...
 
ModeratedListContainer ModeratedSubreddits (string username, UsersHistoryInput usersHistoryInput)
 Retrieve a list of subreddits that the user moderates. This endpoint is a listing. More...
 
OverviewContainer Overview (string username, UsersHistoryInput usersHistoryInput)
 Get a user's post and comment history. This endpoint is a listing. More...
 
PostContainer PostHistory (string username, string where, UsersHistoryInput usersHistoryInput)
 Get a user's post history. This endpoint is a listing. More...
 
CommentContainer CommentHistory (string username, string where, UsersHistoryInput usersHistoryInput)
 Get a user's comment history. This endpoint is a listing. More...
 
- Public Member Functions inherited from Reddit.Models.BaseModel
 BaseModel (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
string Sr (string subreddit)
 
- Public Member Functions inherited from Reddit.Models.Internal.Request
 Request (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
SendRequest< T > (string url, dynamic parameters, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
async Task< T > SendRequestAsync< T > (string url, dynamic parameters, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareIDRequest (string path, string id, Method method=Method.POST)
 
RestRequest PrepareJSONRequest (string path, Method method=Method.POST)
 
RestRequest PrepareRequest (string url, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareRequest (string url, Method method, List< Parameter > parameters, List< FileParameter > files, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareRequest (RestRequest restRequest, string contentType="application/x-www-form-urlencoded")
 
string GetVersion ()
 
string ExecuteRequest (string url, Method method=Method.GET)
 
async Task< string > ExecuteRequestAsync (string url, Method method=Method.GET)
 
string ExecuteRequest (RestRequest restRequest)
 
async Task< string > ExecuteRequestAsync (RestRequest restRequest)
 
void UpdateAccessToken (string accessToken)
 
void UpdateRequests (List< DateTime > requests)
 
void AddParamIfNotNull (string name, dynamic value, ref RestRequest restRequest)
 

Additional Inherited Members

- Protected Member Functions inherited from Reddit.Models.Internal.Request
virtual void OnTokenUpdated (TokenUpdateEventArgs e)
 
virtual void OnRequestsUpdated (RequestsUpdateEventArgs e)
 
- Events inherited from Reddit.Models.Internal.Request
EventHandler< TokenUpdateEventArgsTokenUpdated
 
EventHandler< RequestsUpdateEventArgsRequestsUpdated
 

Constructor & Destructor Documentation

◆ Users()

Reddit.Models.Users.Users ( string  appId,
string  appSecret,
string  refreshToken,
string  accessToken,
ref RestClient  restClient,
string  deviceId = null,
string  userAgent = null 
)

Member Function Documentation

◆ About()

UserChild Reddit.Models.Users.About ( string  username)

Return information about the user, including karma and gold status.

Parameters
usernamethe name of an existing user
Returns
A user listing.

◆ BlockUser()

UserActionResult Reddit.Models.Users.BlockUser ( UsersBlockUserInput  usersBlockUserInput)

For blocking a user.

Parameters
usersBlockUserInputA valid UserActionResult input
Returns
An object containing basic info on the target user and the datetime of this action.

◆ BlockUserAsync()

async Task<UserActionResult> Reddit.Models.Users.BlockUserAsync ( UsersBlockUserInput  usersBlockUserInput)

For blocking a user asynchronously.

Parameters
usersBlockUserInputA valid UserActionResult input
Returns
An object containing basic info on the target user and the datetime of this action.

◆ CommentHistory()

CommentContainer Reddit.Models.Users.CommentHistory ( string  username,
string  where,
UsersHistoryInput  usersHistoryInput 
)

Get a user's comment history. This endpoint is a listing.

Parameters
usernamethe name of an existing user
whereOne of (comments, saved, gilded)
usersHistoryInputA valid UsersHistoryInput instance
Returns
A list of objects containing the requested data.

◆ DeleteFriend()

void Reddit.Models.Users.DeleteFriend ( string  username)

Stop being friends with a user.

Parameters
usernameA valid, existing reddit username

◆ DeleteFriendAsync()

async Task Reddit.Models.Users.DeleteFriendAsync ( string  username)

Stop being friends with a user asynchronously.

Parameters
usernameA valid, existing reddit username

◆ Friend()

GenericContainer Reddit.Models.Users.Friend ( UsersFriendInput  usersFriendInput,
string  subreddit = null 
)

Create a relationship between a user and another user or subreddit. OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: Use "moderator_invite" moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_unfriend

Parameters
usersFriendInputA valid UsersFriendInput instance
subredditA subreddit
Returns
An object indicating any errors.

◆ FriendAsync()

async Task<GenericContainer> Reddit.Models.Users.FriendAsync ( UsersFriendInput  usersFriendInput,
string  subreddit = null 
)

Create a relationship between a user and another user or subreddit asynchronously. OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: Use "moderator_invite" moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_unfriend

Parameters
usersFriendInputA valid UsersFriendInput instance
subredditA subreddit
Returns
An object indicating any errors.

◆ GetFriend()

UserActionResult Reddit.Models.Users.GetFriend ( string  username)

Get information about a specific 'friend', such as notes.

Parameters
usernameA valid, existing reddit username
Returns
An object containing basic info on the target user and the datetime of this action.

◆ GetUser< T >()

T Reddit.Models.Users.GetUser< T > ( string  username,
string  where,
UsersHistoryInput  usersHistoryInput 
)

This endpoint is a listing.

Parameters
usernamethe name of an existing user
whereOne of (overview, submitted, upvotes, downvoted, hidden, saved, gilded, moderated_subreddits)
usersHistoryInputA valid UsersHistoryInput instance
Returns
A list of objects containing the requested data.

◆ ModeratedSubreddits()

ModeratedListContainer Reddit.Models.Users.ModeratedSubreddits ( string  username,
UsersHistoryInput  usersHistoryInput 
)

Retrieve a list of subreddits that the user moderates. This endpoint is a listing.

Parameters
usernamethe name of an existing user
usersHistoryInputA valid UsersHistoryInput instance
Returns
A list of objects containing the requested data.

◆ Overview()

OverviewContainer Reddit.Models.Users.Overview ( string  username,
UsersHistoryInput  usersHistoryInput 
)

Get a user's post and comment history. This endpoint is a listing.

Parameters
usernamethe name of an existing user
usersHistoryInputA valid UsersHistoryInput instance
Returns
A list of objects containing the requested data.

◆ PostHistory()

PostContainer Reddit.Models.Users.PostHistory ( string  username,
string  where,
UsersHistoryInput  usersHistoryInput 
)

Get a user's post history. This endpoint is a listing.

Parameters
usernamethe name of an existing user
whereOne of (submitted, upvotes, downvoted, hidden, saved, gilded)
usersHistoryInputA valid UsersHistoryInput instance
Returns
A list of objects containing the requested data.

◆ ReportUser()

void Reddit.Models.Users.ReportUser ( UsersReportUserInput  usersReportUserInput)

Report a user. Reporting a user brings it to the attention of a Reddit admin.

Parameters
usersReportUserInputA valid UsersReportUserInput instance

◆ ReportUserAsync()

async Task Reddit.Models.Users.ReportUserAsync ( UsersReportUserInput  usersReportUserInput)

Report a user asynchronously. Reporting a user brings it to the attention of a Reddit admin.

Parameters
usersReportUserInputA valid UsersReportUserInput instance

◆ SetPermissions()

GenericContainer Reddit.Models.Users.SetPermissions ( UsersSetPermissionsInput  usersSetPermissionsInput,
string  subreddit = null 
)

Set permissions.

Parameters
usersSetPermissionsInputA valid UsersSetPermissionsInput instance
subredditA subreddit
Returns
An object indicating any errors.

◆ SetPermissionsAsync()

async Task<GenericContainer> Reddit.Models.Users.SetPermissionsAsync ( UsersSetPermissionsInput  usersSetPermissionsInput,
string  subreddit = null 
)

Set permissions asynchronously.

Parameters
usersSetPermissionsInputA valid UsersSetPermissionsInput instance
subredditA subreddit
Returns
An object indicating any errors.

◆ Trophies()

TrophyList Reddit.Models.Users.Trophies ( string  username)

Return a list of trophies for the given user.

Parameters
usernameA valid, existing reddit username
Returns
A list of trophies.

◆ Unfriend()

void Reddit.Models.Users.Unfriend ( UsersUnfriendInput  usersUnfriendInput,
string  subreddit = null 
)

Remove a relationship between a user and another user or subreddit. The user can either be passed in by name (nuser) or by fullname (iuser). If type is friend or enemy, 'container' MUST be the current user's fullname; for other types, the subreddit must be set via URL (e.g., /r/funny/api/unfriend). OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: modothers moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_friend

Parameters
usersUnfriendInputA valid UsersUnfriendInput instance
subredditA subreddit

◆ UnfriendAsync()

async Task Reddit.Models.Users.UnfriendAsync ( UsersUnfriendInput  usersUnfriendInput,
string  subreddit = null 
)

Remove a relationship between a user and another user or subreddit asynchronously. The user can either be passed in by name (nuser) or by fullname (iuser). If type is friend or enemy, 'container' MUST be the current user's fullname; for other types, the subreddit must be set via URL (e.g., /r/funny/api/unfriend). OAuth2 use requires appropriate scope based on the 'type' of the relationship: moderator: modothers moderator_invite: modothers contributor: modcontributors banned: modcontributors muted: modcontributors wikibanned: modcontributors and modwiki wikicontributor: modcontributors and modwiki friend: Use /api/v1/me/friends/{username} enemy: Use /api/block Complement to POST_friend

Parameters
usersUnfriendInputA valid UsersUnfriendInput instance
subredditA subreddit

◆ UpdateFriend()

UserActionResult Reddit.Models.Users.UpdateFriend ( string  username,
string  json = "{}" 
)

Create or update a "friend" relationship. This operation is idempotent. It can be used to add a new friend, or update an existing friend (e.g., add/change the note on that friend).

Parameters
usernameA valid, existing reddit username
json{ "name": A valid, existing reddit username "note": a string no longer than 300 characters }
Returns
An object containing basic info on the target user and the datetime of this action.

◆ UpdateFriendAsync()

async Task<UserActionResult> Reddit.Models.Users.UpdateFriendAsync ( string  username,
string  json = "{}" 
)

Create or update a "friend" relationship asynchronously. This operation is idempotent. It can be used to add a new friend, or update an existing friend (e.g., add/change the note on that friend).

Parameters
usernameA valid, existing reddit username
json{ "name": A valid, existing reddit username "note": a string no longer than 300 characters }
Returns
An object containing basic info on the target user and the datetime of this action.

◆ UserDataByAccountIds()

Dictionary<string, UserSummary> Reddit.Models.Users.UserDataByAccountIds ( string  ids)

Get user data by account IDs.

Parameters
idsA comma-separated list of account fullnames
Returns
A dictionary of user summary objects.

◆ UsernameAvailable()

bool? Reddit.Models.Users.UsernameAvailable ( string  user)

Check whether a username is available for registration.

Parameters
usera valid, unused username
Returns
Boolean or null if error (i.e. invalid username).

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