Struct orca::App
[−]
[src]
pub struct App { /* fields omitted */ }
Methods
impl App
[src]
fn new(appname: &str, appversion: &str, appauthor: &str) -> App
Create a new reddit instance
Arguments
appname
- Unique app nameappversion
- App versionappauthor
- Auther of the app # Returns A new reddit object
Return an Auth object for use with API calls that require a user account to work
Arguments
username
- Username of the user to be authorized aspassword
- Password of the user to be authorized asoauth
- Oauth app type # Returns A result containing either an Auth object or a certain error To use place it in the auth field of a connection struct
fn get_posts(&mut self, sub: String, sort: Sort) -> Result<Value, ()>
Get the posts in a subreddit sorted in a specific way
Arguments
sub
- Name of subreddit to querysort
- Sort method of query # Returns A result containing a json listing of posts
fn submit_self(
&mut self,
sub: String,
title: String,
text: String,
sendreplies: bool
) -> Result<Value, ()>
&mut self,
sub: String,
title: String,
text: String,
sendreplies: bool
) -> Result<Value, ()>
Submit a self post
Arguments
sub
- Name of the subreddit to submit a post totitle
- Title of the posttext
- Body of the post # Returns A result with reddit's json response to the submission
fn get_user(&mut self) -> Result<Value, ()>
Get info of the user currently authorized
Note: requires connection to be authorized
Returns
A result with the json value of the user data
fn get_comments(&mut self, sub: String) -> Comments
Get a iterator of all comments in order of being posted
Arguments
sub
- Name of the subreddit to pull comments from. Can be 'all' to pull from all of reddit