pub struct App { /* fields omitted */ }
A reddit object
To create a new instance, use Reddit::new()
Loads a thing and casts it to the type of anything as long as it implements the Thing trait. Experimental
fullame
- fullname of the thing
Get the posts in a subreddit sorted in a specific way
sub
- Name of subreddit to query
sort
- Sort method of query
A result containing a json listing of posts
Get a iterator of all comments in order of being posted
sub
- Name of the subreddit to pull comments from. Can be 'all' to pull from all of reddit
Gets the most recent comments in a subreddit. This function is also usually called internally but
can be called if a one time retrieval of recent comments from a subreddit is necessary
sub
- Subreddit to load recent comments from
limit
- Optional limit to amount of comments loaded
before
- Optional comment to be the starting point for the next comments loaded
A listing of comments that should be flat (no replies)
Loads the comment tree of a post, returning a listing of the Comment enum, which can be
either Loaded or NotLoaded
post
- The name of the post to retrieve the tree from
A fully populated listing of commments (no more
values)
Comment on a thing. The thing
can be a post, a comment, or a private message
text
- The body of the comment
thing
- Fullname of the thing to comment on
Load more comments from a comment tree that is not completely loaded. This function at the moment can only be called
internally due to requiring morechildren_id
that is not available in the Thread
type.
link_id
- The id of the post that has the comments that are being loaded
morechildren_id
- The id of the morechildren object that is being loaded
comments
- Slice of &str
s that are the ids of the comments to be loaded
Sticky a post in a subreddit. Does nothing if the post is already stickied
sticky
- boolean value. True to set post as sticky, false to unset post as sticky
slot
- Optional slot number to fill (can only be 1 or 2, and will error otherwise)
id
- fullname of the post to sticky
Submit a self post
sub
- Name of the subreddit to submit a post to
title
- Title of the post
text
- Body of the post
sendreplies
- Whether replies should be forwarded to the inbox of the submitter
A result with reddit's json response to the submission
Send a private message to a user
to
- Name of the user to send a message to
subject
- Subject of the message
body
- Body of the message
Authorize this app as a script
id
- The app id registered on Reddit
secret
- The app secret registered on Reddit
username
- The username of the user to authorize as
password
- The password of the user to authorize as
Authorize this app as an installed app
conn
- A reference to the connection to authorize
id
- The app id registered on Reddit
redirect
- The app redirect URI registered on Reddit
response_gen
- An optional function that generates a hyper Response to give to the user
based on the result of the authorization attempt. The signature is (Result<String, InstalledAppError) -> Result<Response, Response>
.
The result passed in is either Ok with the code recieved, or Err with the error that occurred.
The value returned should usually be an Ok(Response), but you can return Err(Response) to indicate
that an error occurred within the function.
scopes
- A reference to a Scopes instance representing the capabilites you are requesting
as an installed app.
Gets information about a user that is not currently authorized
name
- username of the user to query
A json value containing the user info
Get info of the user currently authorized
Note: requires connection to be authorized
A result with the json value of the user data
Create a new reddit instance
appname
- Unique app name
appversion
- App version
appauthor
- Auther of the app
A new reddit object
Sets the method to use for ratelimiting.
limit
- The method to use for ratelimiting